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

    QuerySnapshot - Snapshot class to store the results of query execution.

    Type Parameters

    • T = any
    Index

    Constructors

    Properties

    docs: readonly QueryDocumentSnapshot<T>[]

    An array of all the documents in the QuerySnapshot.

    empty: boolean

    True if there are no documents in the QuerySnapshot.

    Metadata about this snapshot, concerning its source and if it has local modifications.

    query: Query<T>

    The query on which you called get() or onSnapshot() in order to get this QuerySnapshot.

    size: number

    The number of documents in the QuerySnapshot.

    Methods

    • Returns an array of document changes.

      Parameters

      • Optionaloptions: { includeMetadataChanges: boolean }

        Options for changes.

      Returns {
          doc: QueryDocumentSnapshot<T>;
          newIndex: number;
          oldIndex: number;
          type: "removed" | "added" | "modified";
      }[]

      Array of document changes.

      • doc: QueryDocumentSnapshot<T>

        The document affected by this change.

      • newIndex: number

        The index of the changed document in the result set immediately after this DocumentChange (i.e. supposing that all prior DocumentChange objects have been applied). -1 for 'removed' events.

      • oldIndex: number

        The index of the changed document in the result set immediately prior to this DocumentChange (i.e. supposing that all prior DocumentChange objects have been applied). -1 for 'added' events.

      • type: "removed" | "added" | "modified"

        The type of change ('added', 'modified', or 'removed').

    • Enumerates all of the documents in the QuerySnapshot.

      Parameters

      • callback: (result: QueryDocumentSnapshot<T>) => void

        Callback function to execute for each document.

      • OptionalthisArg: any

      Returns void

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

      Parameters

      Returns boolean

      True if equal, false otherwise.

      Throws an error if snap is not a QuerySnapshot instance.