firebase-admin.firestore package Stay organized with collections Save and categorize content based on your preferences.
External API Re-exports
The following externally defined APIs are re-exported from this module entry point for convenience.
Symbol | Description |
---|---|
BulkWriter | BulkWriter type from the@google-cloud/firestore package. |
AggregateField | AggregateField type from the@google-cloud/firestore package. |
BulkWriterOptions | BulkWriterOptions type from the@google-cloud/firestore package. |
BundleBuilder | BundleBuilder type from the@google-cloud/firestore package. |
CollectionGroup | CollectionGroup type from the@google-cloud/firestore package. |
CollectionReference | CollectionReference type from the@google-cloud/firestore package. |
DocumentChange | DocumentChange type from the@google-cloud/firestore package. |
DocumentData | DocumentData type from the@google-cloud/firestore package. |
DocumentReference | DocumentReference type from the@google-cloud/firestore package. |
DocumentSnapshot | DocumentSnapshot type from the@google-cloud/firestore package. |
FieldPath | FieldPath type from the@google-cloud/firestore package. |
FieldValue | FieldValue type from the@google-cloud/firestore package. |
Filter | Filter type from the@google-cloud/firestore package. |
Firestore | Firestore type from the@google-cloud/firestore package. |
FirestoreDataConverter | FirestoreDataConverter type from the@google-cloud/firestore package. |
GeoPoint | GeoPoint type from the@google-cloud/firestore package. |
GrpcStatus | GrpcStatus type from the@google-cloud/firestore package. |
Precondition | Precondition type from the@google-cloud/firestore package. |
Query | Query type from the@google-cloud/firestore package. |
QueryDocumentSnapshot | QueryDocumentSnapshot type from the@google-cloud/firestore package. |
QueryPartition | QueryPartition type from the@google-cloud/firestore package. |
QuerySnapshot | QuerySnapshot type from the@google-cloud/firestore package. |
ReadOptions | ReadOptions type from the@google-cloud/firestore package. |
SetOptions | SetOptions type from the@google-cloud/firestore package. |
Timestamp | Timestamp type from the@google-cloud/firestore package. |
Transaction | Transaction type from the@google-cloud/firestore package. |
WriteBatch | WriteBatch type from the@google-cloud/firestore package. |
WriteResult | WriteResult type from the@google-cloud/firestore package. |
setLogFunction | setLogFunction function from the@google-cloud/firestore package. |
Cloud Firestore.
Functions
Function | Description |
---|---|
getFirestore() | Gets the defaultFirestore service for the default app. |
getFirestore(app) | Gets the defaultFirestore service for the given app. |
getFirestore(databaseId) | (BETA) Gets the namedFirestore service for the default app. |
getFirestore(app, databaseId) | (BETA) Gets the namedFirestore service for the given app. |
initializeFirestore(app, settings) | Gets the defaultFirestore service for the given app, passing extra parameters to its constructor. |
initializeFirestore(app, settings, databaseId) | (BETA) Gets the namedFirestore service for the given app, passing extra parameters to its constructor. |
Classes
Class | Description |
---|---|
FirebaseFirestoreError | Firebase Firestore error code structure. This extends FirebaseError. |
Interfaces
Interface | Description |
---|---|
FirestoreSettings | Settings to pass to the Firestore constructor. |
getFirestore()
Gets the defaultFirestore service for the default app.
Signature:
exportdeclarefunctiongetFirestore():Firestore;
Returns:
Firestore
The defaultFirestore service for the default app.
Example
// Get the default Firestore service for the default appconstdefaultFirestore=getFirestore();
getFirestore(app)
Gets the defaultFirestore service for the given app.
Signature:
exportdeclarefunctiongetFirestore(app:App):Firestore;
Parameters
Parameter | Type | Description |
---|---|---|
app | App | whichFirestore service to return. |
Returns:
Firestore
The defaultFirestore service associated with the provided app.
Example
// Get the default Firestore service for a specific appconstotherFirestore=getFirestore(app);
getFirestore(databaseId)
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Gets the namedFirestore service for the default app.
Signature:
exportdeclarefunctiongetFirestore(databaseId:string):Firestore;
Parameters
Parameter | Type | Description |
---|---|---|
databaseId | string | name of database to return. |
Returns:
Firestore
The namedFirestore service for the default app.
Example
// Get the Firestore service for a named database and default appconstotherFirestore=getFirestore('otherDb');
getFirestore(app, databaseId)
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Gets the namedFirestore service for the given app.
Signature:
exportdeclarefunctiongetFirestore(app:App,databaseId:string):Firestore;
Parameters
Parameter | Type | Description |
---|---|---|
app | App | whichFirestore service to return. |
databaseId | string | name of database to return. |
Returns:
Firestore
The namedFirestore service associated with the provided app.
Example
// Get the Firestore service for a named database and specific app.constotherFirestore=getFirestore('otherDb');
initializeFirestore(app, settings)
Gets the defaultFirestore service for the given app, passing extra parameters to its constructor.
Signature:
exportdeclarefunctioninitializeFirestore(app:App,settings?:FirestoreSettings):Firestore;
Parameters
Parameter | Type | Description |
---|---|---|
app | App | whichFirestore service to return. |
settings | FirestoreSettings | Settings object to be passed to the constructor. |
Returns:
Firestore
The defaultFirestore
service associated with the provided app and settings.
Example
// Get the Firestore service for a specific app, require HTTP/1.1 REST transportconstotherFirestore=initializeFirestore(app,{preferRest:true});
initializeFirestore(app, settings, databaseId)
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Gets the namedFirestore service for the given app, passing extra parameters to its constructor.
Signature:
exportdeclarefunctioninitializeFirestore(app:App,settings:FirestoreSettings,databaseId:string):Firestore;
Parameters
Parameter | Type | Description |
---|---|---|
app | App | whichFirestore service to return. |
settings | FirestoreSettings | Settings object to be passed to the constructor. |
databaseId | string | name of database to return. |
Returns:
Firestore
The namedFirestore
service associated with the provided app and settings.
Example
// Get the Firestore service for a specific app, require HTTP/1.1 REST transportconstotherFirestore=initializeFirestore(app,{preferRest:true},'otherDb');
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 2024-05-21 UTC.