cheatsheet firestore

- Posted in Firebase by
reff = db.collection('ngetest');

reff.doc('mydoc').add(data);
 // set sama seperti add tapi jika exist update
reff.doc('mydoc').set(data);
reff.doc('mydoc').update(data);

reff.where('test', '==', 'ok')
 .get().then(function(querySnapshot) {
//querySnapshot.size
})


reff.doc("doocument")
 .get().then(function(doc) {
//doc.data()
//doc.id
})
Tags: