how to run the update on firestore database from database code example
Example 1: firestore set a document
let data = {
name: 'Los Angeles',
state: 'CA',
country: 'USA'
};
// Add a new document in collection "cities" with ID 'LA'
let setDoc = db.collection('cities').doc('LA').set(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'
});