Oracle® Backend For Firebase JavaScript Namespace SDK Reference, Release 26.1.0
    Preparing search index...
    Oracle® Backend For Firebase JavaScript Namespace SDK Reference
    Release 26.1.0

    G48197-02

    A write batch is used to perform multiple writes as a single atomic unit. A WriteBatch object can be acquired by calling Oracledb.batch(). It provides methods for adding writes to the write batch. Partial failure is not supported, so the entire batch will either succeed or fail.

    Index

    Constructors

    Methods

    Constructors

    Methods

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

      The Oracledb type does not support preconditions.

      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).

    • Deletes the document referred to by the provided DocumentReference.

      Parameters

      Returns WriteBatch

      This WriteBatch instance. Used for chaining method calls.

    • Write to the document referred to by the provided DocumentReference. If the document does not exist yet, it will be created. If you provide merge or mergeFields, the provided data can be merged into an existing document.

      Type Parameters

      • T

      Parameters

      • documentRef: DocumentReference<T>

        A reference to the document to be set.

      • data: T

        An object of the fields and values for the document.

      • Optionaloptions: { merge?: boolean; mergeFields?: (string | FieldPath)[] }

        An object to configure the set behavior.

      Returns WriteBatch

      This WriteBatch instance. Used for chaining method calls.

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

      Parameters

      • documentRef: DocumentReference<any>

        A reference to the document to be updated.

      • data: { [field: string]: any }

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

      Returns WriteBatch

      This WriteBatch instance. Used for chaining method calls.

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

      Nested fields can be update by providing dot-separated field path strings or by providing FieldPath values.

      Parameters

      • documentRef: DocumentReference<any>

        A reference to the document to be updated.

      • field: string | FieldPath

        The first field to update.

      • value: any

        The first value.

      • ...fieldsOrPrecondition: any[]

        Optional additional selector/value pairs or a precondition if not using fieldsOrPrecondition.

      Returns WriteBatch

      This WriteBatch instance. Used for chaining method calls.