edit firestore rules code example
Example: Firestore decrement field
const userRef = db.collection('documents').doc('document_id');
const decrement = firebase.firestore.FieldValue.increment(-1);
userRef.update({ fieldToDecrease: decrement });
const userRef = db.collection('documents').doc('document_id');
const decrement = firebase.firestore.FieldValue.increment(-1);
userRef.update({ fieldToDecrease: decrement });