voluptasmollitia
Version:
Monorepo for the Firebase JavaScript SDK
29 lines (16 loc) • 1.11 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@firebase/firestore](./firestore.md) > [/](./firestore_.md) > [getDocs](./firestore_.getdocs.md)
## getDocs() function
Executes the query and returns the results as a `QuerySnapshot`<!-- -->.
Note: `getDocs()` attempts to provide up-to-date data when possible by waiting for data from the server, but it may return cached data or fail if you are offline and the server cannot be reached. To specify this behavior, invoke [getDocsFromCache()](./firestore_.getdocsfromcache.md) or [getDocsFromServer()](./firestore_.getdocsfromserver.md)<!-- -->.
<b>Signature:</b>
```typescript
export declare function getDocs<T>(query: Query<T>): Promise<QuerySnapshot<T>>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| query | [Query](./firestore_.query.md)<!-- --><T> | |
<b>Returns:</b>
Promise<[QuerySnapshot](./firestore_.querysnapshot.md)<!-- --><T>>
A Promise that will be resolved with the results of the query.