set
set
works the same as firestore set
but with the same syntax as the sweetened get
.
add doc with specified id
await db.set({name: "Bob", age: 30}, "users", "bob")
// equivalent firestore
await fb.collection("users").doc("bob").set({name: "Bob", age: 30})
reset multiple docs with query
await db.set({name: "John", 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.set(ss._ref, {name: "John", age: 30})
})
await batch.commit()