The Firebase JS SDK is now in BETA!
This EAP site is no longer maintained. See the official Firebase Documentation site for the latest documentation and information about the Firebase JS SDK.

Home > @firebase/firestore > / > WriteBatch > commit

WriteBatch.commit() method

Commits all of the writes in this write batch as a single atomic unit.

The result of these writes will only be reflected in document reads that occur after the returned Promise resolves. If the client is offline, the write fails. If you would like to see local modifications or buffer writes until the client is online, use the full Firestore SDK.

Signature:

commit(): Promise<void>;

Returns:

Promise<void>

A Promise resolved once all of the writes in the batch have been successfully written to the backend as an atomic unit (note that it won't resolve while you're offline).