Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GeoWriteBatch

A write batch, used to perform multiple writes as a single atomic unit.

A GeoWriteBatch object can be acquired by calling GeoFirestore.batch(). It provides methods for adding writes to the write batch. None of the writes will be committed (or visible locally) until GeoWriteBatch.commit() is called.

Unlike transactions, write batches are persisted offline and therefore are preferable when you don't need to condition your writes on read data.

Hierarchy

  • GeoWriteBatch

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

Private _writeBatch

_writeBatch: WriteBatch | WriteBatch

Methods

commit

  • commit(): Promise<any>
  • Commits all of the writes in this write batch as a single atomic unit.

    Returns Promise<any>

    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.

delete

set

  • Writes to the document referred to by the provided DocumentReference or GeoDocumentReference. If the document does not exist yet, it will be created. If you pass SetOptions, the provided data can be merged into the existing document.

    Parameters

    Returns GeoWriteBatch

    This GeoWriteBatch instance. Used for chaining method calls.

update

  • Updates fields in the document referred to by the provided DocumentReference or GeoDocumentReference. The update will fail if applied to a document that does not exist.

    Parameters

    • documentRef: GeoDocumentReference | DocumentReference | DocumentReference

      A reference to the document to be updated.

    • data: UpdateData

      An object containing the fields and values with which to update the document. Fields can contain dots to reference nested fields within the document.

    • Optional customKey: string

      The key of the document to use as the location. Otherwise we default to coordinates.

    Returns GeoWriteBatch

    This GeoWriteBatch instance. Used for chaining method calls.

Generated using TypeDoc