AQuerySnapshot contains zero or moreDocumentSnapshot objectsrepresenting the results of a query. The documents can be accessed as anarray via thedocs property or enumerated using theforEach method. Thenumber of documents can be determined via theempty andsizeproperties.

Type parameters

  • T

Index

Constructors

Private constructor

Properties

docs

docs:Array<QueryDocumentSnapshot<T>>

An array of all the documents in theQuerySnapshot.

empty

empty:boolean

True if there are no documents in theQuerySnapshot.

metadata

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

query

query:Query<T>

The query on which you calledget oronSnapshot in order to get thisQuerySnapshot.

size

size:number

The number of documents in theQuerySnapshot.

Methods

docChanges

  • docChanges(options?: SnapshotListenOptions):Array<DocumentChange<T>>
  • Returns an array of the documents changes since the last snapshot. If thisis the first snapshot, all documents will be in the list as added changes.

    Parameters

    • Optional options:SnapshotListenOptions

      SnapshotListenOptions that control whether metadata-onlychanges (i.e. onlyDocumentSnapshot.metadata changed) should triggersnapshot events.

    ReturnsArray<DocumentChange<T>>

forEach

  • forEach(callback(resultQueryDocumentSnapshot<T>) =>void, thisArg?: any):void
  • Enumerates all of the documents in theQuerySnapshot.

    Parameters

    Returnsvoid

isEqual

  • isEqual(otherQuerySnapshot<T>):boolean
  • Returns true if thisQuerySnapshot is equal to the provided one.

    Parameters

    Returnsboolean

    true if thisQuerySnapshot is equal to the provided one.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2022-07-27 UTC.