Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

QuerySnapshot

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.

class QuerySnapshot<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> {
private constructor();
get docs(): Array<QueryDocumentSnapshot<AppModelType, DbModelType>>;
get empty(): boolean;
readonly metadata: SnapshotMetadata;
readonly query: Query<AppModelType, DbModelType>;
get size(): number;
 
docChanges(options?: SnapshotListenOptions): Array<DocumentChange<AppModelType, DbModelType>>;
forEach(callback: (result: QueryDocumentSnapshot<AppModelType, DbModelType>) => void, thisArg?: unknown): void;
}

§Type Parameters

§
AppModelType = DocumentData
[src]
§
DbModelType extends DocumentData = DocumentData
[src]

§Constructors

§
new QuerySnapshot() private
[src]

§Properties

§
docs: Array<QueryDocumentSnapshot<AppModelType, DbModelType>> readonly
[src]

An array of all the documents in the QuerySnapshot.

§
empty: boolean readonly
[src]

True if there are no documents in the QuerySnapshot.

§

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

§
query: Query<AppModelType, DbModelType>
[src]

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

§
size: number readonly
[src]

The number of documents in the QuerySnapshot.

§Methods

§
docChanges(options?: SnapshotListenOptions): Array<DocumentChange<AppModelType, DbModelType>>
[src]

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.

@param options
  • SnapshotListenOptions that control whether metadata-only changes (i.e. only DocumentSnapshot.metadata changed) should trigger snapshot events.
§
forEach(callback: (result: QueryDocumentSnapshot<AppModelType, DbModelType>) => void, thisArg?: unknown): void
[src]

Enumerates all of the documents in the QuerySnapshot.

@param callback
  • A callback to be called with a QueryDocumentSnapshot for each document in the snapshot.
@param thisArg
  • The this binding for the callback.