TL;DR - There are conventions/payloads/actions out there, which requires more than 1 batch write to take place.
It occur to me that when im adding a set operation to a batch, for an object which is using firestore serverTimstamp feature, it costs 2 write operations rather than 1.
Could not find any documentation about that.
The problem is, that if you wrap firestore batch with a local counter in your code, to avoid reaching the 500 threshold, you might miss-calculate batch size.
In my example, I am using Golang firestore sdk (but I do believe this issue will be common for all other sdk's because it derives from firestore fundamental mechanism)
batch.Set(ctx, docRef, struct {
LastUpdate time.Time `firestore:"lastUpdate,serverTimestamp"`
}{}, firestore.MergeAll)
--> batch.writes was increased by 2 writes rather than 1
My question is - are any other special firestore values/actions etc' which might also require more than 1 batch write operation to take place? Also do anyone can suggest a workaround for that issue?