?
Mutation
TypeA pending write. Batchable and awaitable, with per-call error handling.
The pending result of a write from push, update, upsert, remove, removeAll, or clear. Awaiting it runs the write. Passing several to db.batch runs them in order in one round trip, and later reads in that batch observe them. It is thenable, so .catch handles one write's failure, such as a unique-constraint conflict, without a surrounding try/catch.
Mutation.ts
interface Mutation<T> { then(onResolved): Promise<T> catch(onRejected): Promise<T> }
Fields
then
(onResolved)
Awaiting the Mutation runs the write and resolves the row.
catch
(onRejected)
Handles one write's failure, such as a unique-constraint conflict.
Batch writes
await db.batch( Vendors.update(id, { status: 'approved' }), Orders.push({ vendorId: id, total }), );