Stay organized with collections
Save and categorize content based on your preferences.
Methods
forEach
- forEach
(
callback
:
(
result
:
QueryDocumentSnapshot
<
T
>
)
=>
void
,
thisArg
?
:
any
)
:
void
-
Parameters
Returns void
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2022-07-27 UTC.
[null,null,["Last updated 2022-07-27 UTC."],[],[],null,["- [firebase](/docs/reference/node/firebase).\n- [firestore](/docs/reference/node/firebase.firestore).\n- QuerySnapshot\n\\\u003c T \\\u003e \nA `QuerySnapshot` contains zero or more `DocumentSnapshot` objects\nrepresenting the results of a query. The documents can be accessed as an\narray via the `docs` property or enumerated using the `forEach` method. The\nnumber of documents can be determined via the `empty` and `size`\nproperties.\n\nType parameters\n\n-\n\n T\n\nIndex\n\nConstructors\n\n- [constructor](/docs/reference/node/firebase.firestore.QuerySnapshot#constructor)\n\nProperties\n\n- [docs](/docs/reference/node/firebase.firestore.QuerySnapshot#docs)\n- [empty](/docs/reference/node/firebase.firestore.QuerySnapshot#empty)\n- [metadata](/docs/reference/node/firebase.firestore.QuerySnapshot#metadata)\n- [query](/docs/reference/node/firebase.firestore.QuerySnapshot#query)\n- [size](/docs/reference/node/firebase.firestore.QuerySnapshot#size)\n\nMethods\n\n- [docChanges](/docs/reference/node/firebase.firestore.QuerySnapshot#docchanges)\n- [forEach](/docs/reference/node/firebase.firestore.QuerySnapshot#foreach)\n- [isEqual](/docs/reference/node/firebase.firestore.QuerySnapshot#isequal)\n\nConstructors\n\nPrivate constructor\n\n- new QuerySnapshot ( ) : [QuerySnapshot](/docs/reference/node/firebase.firestore.QuerySnapshot)\n-\n\n Returns [QuerySnapshot](/docs/reference/node/firebase.firestore.QuerySnapshot)\n\nProperties\n\ndocs \ndocs: Array\\\u003c[QueryDocumentSnapshot](/docs/reference/node/firebase.firestore.QueryDocumentSnapshot)\\\u003cT\\\u003e\\\u003e \nAn array of all the documents in the `QuerySnapshot`.\n\nempty \nempty: boolean \nTrue if there are no documents in the `QuerySnapshot`.\n\nmetadata \nmetadata: [SnapshotMetadata](/docs/reference/node/firebase.firestore.SnapshotMetadata) \nMetadata about this snapshot, concerning its source and if it has local\nmodifications.\n\nquery \nquery: [Query](/docs/reference/node/firebase.firestore.Query)\\\u003cT\\\u003e \nThe query on which you called `get` or `onSnapshot` in order to get this\n`QuerySnapshot`.\n\nsize \nsize: number \nThe number of documents in the `QuerySnapshot`.\n\nMethods\n\ndocChanges\n\n- docChanges ( options ? : [SnapshotListenOptions](/docs/reference/node/firebase.firestore.SnapshotListenOptions) ) : Array \\\u003c [DocumentChange](/docs/reference/node/firebase.firestore.DocumentChange) \\\u003c T \\\u003e \\\u003e\n- Returns an array of the documents changes since the last snapshot. If this\n is the first snapshot, all documents will be in the list as added changes.\n\n Parameters\n -\n\n Optional options: [SnapshotListenOptions](/docs/reference/node/firebase.firestore.SnapshotListenOptions) \n `SnapshotListenOptions` that control whether metadata-only\n changes (i.e. only `DocumentSnapshot.metadata` changed) should trigger\n snapshot events.\n\n Returns Array\\\u003c[DocumentChange](/docs/reference/node/firebase.firestore.DocumentChange)\\\u003cT\\\u003e\\\u003e\n\nforEach\n\n- forEach ( callback : ( result : [QueryDocumentSnapshot](/docs/reference/node/firebase.firestore.QueryDocumentSnapshot) \\\u003c T \\\u003e ) =\\\u003e void , thisArg ? : any ) : void\n- Enumerates all of the documents in the `QuerySnapshot`.\n\n Parameters\n -\n\n callback: (result: [QueryDocumentSnapshot](/docs/reference/node/firebase.firestore.QueryDocumentSnapshot)\\\u003cT\\\u003e) =\\\u003e void \n A callback to be called with a `QueryDocumentSnapshot` for\n each document in the snapshot.\n -\n - (result: [QueryDocumentSnapshot](/docs/reference/node/firebase.firestore.QueryDocumentSnapshot)\\\u003cT\\\u003e): void\n\n \u003c!-- --\u003e\n\n -\n\n Parameters\n -\n\n result: [QueryDocumentSnapshot](/docs/reference/node/firebase.firestore.QueryDocumentSnapshot)\\\u003cT\\\u003e\n\n Returns void\n -\n\n Optional thisArg: any \n The `this` binding for the callback.\n\n Returns void\n\nisEqual\n\n- isEqual ( other : [QuerySnapshot](/docs/reference/node/firebase.firestore.QuerySnapshot) \\\u003c T \\\u003e ) : boolean\n- Returns true if this `QuerySnapshot` is equal to the provided one.\n\n Parameters\n -\n\n other: [QuerySnapshot](/docs/reference/node/firebase.firestore.QuerySnapshot)\\\u003cT\\\u003e \n The `QuerySnapshot` to compare against.\n\n Returns boolean\n\ntrue if this `QuerySnapshot` is equal to the provided one."]]
A
QuerySnapshot
contains zero or moreDocumentSnapshot
objects representing the results of a query. The documents can be accessed as an array via thedocs
property or enumerated using theforEach
method. The number of documents can be determined via theempty
andsize
properties.