node js firestore add +1 to integer code example
Example 1: Firestore increment field
const userRef = db.collection('documents').doc('document_id');
const increment = firebase.firestore.FieldValue.increment(1);
userRef.update({ FieldToIncrease: increment });
Example 2: Firestore decrement field
const userRef = db.collection('documents').doc('document_id');
const decrement = firebase.firestore.FieldValue.increment(-1);
userRef.update({ fieldToDecrease: decrement });