Answers for "update in firestore"

1

firestore batch add array

var db = firebase.firestore();
var batch = db.batch()

save(docs: any[]) {
  docs.forEach((doc) => {
    var docRef = db.collection("col").doc(); //automatically generate unique id
    batch.set(docRef, doc);
  });
  return batch.commit();
}
Posted by: Guest on June-19-2020
6

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);
Posted by: Guest on June-05-2020
2

update data firestore

db.collection("cities").doc("DC").update({
    capital: true
})
Posted by: Guest on August-28-2021

Code answers related to "update in firestore"

Code answers related to "Javascript"

Browse Popular Code Answers by Language