Similar to
firebase.firestore.FieldValue.arrayUnion(value)
firebase.firestore.FieldValue.arrayRemove(value)
would be great if we have option appendValue(n)
where use it only for numbers fields and (n) should be number even positive or negative value.
this will enable us to minimize the number of transactions for counters problem. and even help us to do counter operations on offline mode..
Code Example
var doc = { a:5, b:10};
var n = -1; //any number
var changeCounter = {a : firebase.firestore.FieldValue.appendValue(n)};
firestore.collection('col').document('doc').update(changeCounter);
newDocResult = {a:4, b:10};
Thanks for amazing firestore
As always, I can't promise timelines but this is coming soon. See https://github.com/firebase/firebase-js-sdk/pull/1368.
It will be firebase.firestore.FieldValue.increment.
amazing...
usually i follow every pull request, i miss this one..
Thanks
Most helpful comment
1368 has been merged and will be released in the next release.