Buka konsol

A QuerySnapshot contains zero or more DocumentSnapshot objects representing the results of a query. The documents can be accessed as an array via the docs property or enumerated using the forEach method. The number of documents can be determined via the empty and size properties.

Index

Constructors

Properties

Methods

Constructors

Private constructor

Properties

docs

An array of all the documents in the QuerySnapshot.

empty

empty: boolean

True if there are no documents in the QuerySnapshot.

metadata

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

query

query: Query

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

size

size: number

The number of documents in the QuerySnapshot.

Methods

docChanges

  • docChanges(options?: SnapshotListenOptions): DocumentChange[]
  • Returns an array of the documents changes since the last snapshot. If this is the first snapshot, all documents will be in the list as added changes.

    Parameters

    • Optional options: SnapshotListenOptions

      SnapshotListenOptions that control whether metadata-only changes (i.e. only DocumentSnapshot.metadata changed) should trigger snapshot events.

    Returns DocumentChange[]

forEach

  • forEach(callback: function, thisArg?: any): void
  • Enumerates all of the documents in the QuerySnapshot.

    Parameters

    • callback: function

      A callback to be called with a QueryDocumentSnapshot for each document in the snapshot.

    • Optional thisArg: any

      The this binding for the callback.

    Returns void

isEqual

  • isEqual(other: QuerySnapshot): boolean
  • Returns true if this QuerySnapshot is equal to the provided one.

    Parameters

    Returns boolean

    true if this QuerySnapshot is equal to the provided one.