firestore id field 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: get doc id firestore
const racesCollection: AngularFirestoreCollection<Race>;
return racesCollection.snapshotChanges().map(actions => {
return actions.map(a => {
const data = a.payload.doc.data() as Race;
data.id = a.payload.doc.id;
return data;
});
});