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

    DocumentReference - Represents a reference to a document.

    Type Parameters

    • T = any
    Index

    Constructors

    Properties

    id: string
    oracledb: Oracledb
    parent: CollectionReference<any>
    path: string

    Methods

    • Returns the CollectionReference for the collection at the specified path.

      Parameters

      • colPath: string

      Returns CollectionReference<T>

    • Deletes the document referred by this.

      Returns Promise<void>

    • Reads the document for this.

      Parameters

      • Optionaloptions: { source: "server" }

      Returns Promise<DocumentSnapshot<T>>

    • Checks whether this DocumentReference is equal to the provided one.

      Parameters

      Returns boolean

      Returns true if both DocumentReference instances are the same.

      Throws an error if docRef is not a DocumentReference instance.

    • Attaches callback to be executed on DocumentSnapshot events. This is related to real time listening where we are using long-polling by default.

      ( observer : { complete ?: ( ) => void ; error ?: ( error :
      OracledbError ) => void ; next ?: ( snapshot : DocumentSnapshot => void ) )

      ( onNext : ( snapshot : DocumentSnapshot < T > ) => void , onError ? : ( error : OracledbError ) => void , onCompletion ? : ( ) => void )

      Parameters

      • observer: {
            complete?: () => void;
            error?: (error: Error) => void;
            next?: (snapshot: DocumentSnapshot<T>) => void;
        }

      Returns () => void

    • Writes to the document.

      Parameters

      • data: T
      • OptionalsetOptions: { merge: boolean; mergeFields?: string[] }

      Returns Promise<void>

    • Updates fields for the document referred by this.

      Parameters

      • data: Partial<T>

      Returns Promise<void>

    • Custom data converter, allowing to use user defined classes with database instance. When get is called on the query the results are returned after applying the converter. Passing null will remove the current converter.

      Type Parameters

      • U

      Parameters

      • converter: any

        Object with two functions "fromOracledb" and "toOracledb". fromOracledb will be used to convert the json objects to user defined classes and toOracledb will be used to convert from user defined classes to json objects.

      Returns DocumentReference<U>

      DocumentReference instance with converter.