update
update
works the same as firestore update
but with the same syntax as the sweetened get
.
update doc only if doc already exists
await db.update({age: 40}, "users", "bob")
// equivalent firestore
await fb.collection("users").doc("bob").update({age: 30})
update multiple docs with query
await db.update({age: 30}, "users", ["age", ">", 30])
// equivalent firestore
const docs = await fb.collection("users").doc("bob").where("age", ">", 30).get()
let batch = fb.batch()
docs.forEach((ss)=>{
batch.update(ss._ref, {age: 30})
})
await batch.commit()