The Firebase JS SDK is now in BETA!
This EAP site is no longer maintained. See the official Firebase Documentation site for the latest documentation and information about the Firebase JS SDK.

Home > @firebase/firestore > / > getDocs

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() or getDocsFromServer().

Signature:

export declare function getDocs<T>(query: Query<T>): Promise<QuerySnapshot<T>>;

Parameters

Parameter Type Description
query Query<T>

Returns:

Promise<QuerySnapshot<T>>

A Promise that will be resolved with the results of the query.