db.collection().docs in firebase code example
Example 1: get data in from a collection firestore
db.collection("users").get().then((querySnapshot) => {
querySnapshot.forEach((doc) => {
console.log(`${doc.id} => ${doc.data()}`);
});
Example 2: firestore update map
let initialData = {
name: 'Frank',
age: 12,
favorites: {
food: 'Pizza',
color: 'Blue',
subject: 'recess'
}
};
let updateNested = db.collection('users').doc('Frank').update({
age: 13,
'favorites.color': 'Red'
});