this.app.firestore() .collection('collection') .doc('document') .onSnapshot(function(snapshot) { const id = snapshot.id; //----------OR----------// const data = snapshot.data() || null; if (data) { const id = Object.keys(data)[0]; } });
this.app.firestore() .collection('collection') .doc('document') .onSnapshot(function(snapshot) { const id = snapshot.id; //----------OR----------// const data = snapshot.data() || null; if (data) { const id = Object.keys(data)[0]; } });