I want to create Firestore documents if they don't exist - if they do exist, skip them (don't update). Here's the flow
var arrayOfRandomIds = [array of 500 random numbers];
for (var id of arrayOfRandomIds)
{
var ref = db.collection("tickets").doc(id);
batch.set(ref, {name: "My name", location: "Somewhere"}, { merge: true });
}
batch.commit();
I just want to know, would this overwrite any existing documents if they exist? I don't want anything overwritten, just skipped.
Thanks.
arrayOfRandomIdsis an a array of 500 random numbers, because 500 is the limit for batched write. So can you have number of documents greater than 500?