firebase-admin.database 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 |
|---|---|
| DataSnapshot | DataSnapshot type from the@firebase/database-compat package. |
| EventType | EventType type from the@firebase/database-compat package. |
| OnDisconnect | OnDisconnect type from the@firebase/database-compat package. |
| Query | Query type from the@firebase/database-compat package. |
| Reference | Reference type from the@firebase/database-compat package. |
| ThenableReference | ThenableReference type from the@firebase/database-compat package. |
Firebase Realtime Database.
Functions
| Function | Description |
|---|---|
| getDatabase(app) | Gets theDatabase service for the default app or a given app.getDatabase() can be called with no arguments to access the default app'sDatabase service or asgetDatabase(app) to access theDatabase service associated with a specific app. |
| getDatabaseWithUrl(url, app) | Gets theDatabase service for the default app or a given app.getDatabaseWithUrl() can be called with no arguments to access the default app'sDatabase service or asgetDatabaseWithUrl(app) to access theDatabase service associated with a specific app. |
Classes
| Class | Description |
|---|---|
| FirebaseDatabaseError | Firebase Database error code structure. This extends FirebaseError. |
Interfaces
| Interface | Description |
|---|---|
| Database | The Firebase Database service interface. Extends theDatabase interface provided by the@firebase/database-compat package. |
Variables
| Variable | Description |
|---|---|
| enableLogging | enableLogging function from the@firebase/database-compat package. |
| ServerValue | ServerValue constant from the@firebase/database-compat package. |
getDatabase(app)
Gets theDatabase service for the default app or a given app.
getDatabase() can be called with no arguments to access the default app'sDatabase service or asgetDatabase(app) to access theDatabase service associated with a specific app.
Signature:
exportdeclarefunctiongetDatabase(app?:App):Database;Parameters
| Parameter | Type | Description |
|---|---|---|
| app | App |
Returns:
The defaultDatabase service if no app is provided or theDatabase service associated with the provided app.
Example 1
// Get the Database service for the default appconstdefaultDatabase=getDatabase();Example 2
// Get the Database service for a specific appconstotherDatabase=getDatabase(app);getDatabaseWithUrl(url, app)
Gets theDatabase service for the default app or a given app.
getDatabaseWithUrl() can be called with no arguments to access the default app'sDatabase service or asgetDatabaseWithUrl(app) to access theDatabase service associated with a specific app.
Signature:
exportdeclarefunctiongetDatabaseWithUrl(url:string,app?:App):Database;Parameters
| Parameter | Type | Description |
|---|---|---|
| url | string | |
| app | App |
Returns:
The defaultDatabase service if no app is provided or theDatabase service associated with the provided app.
Example 1
// Get the Database service for the default appconstdefaultDatabase=getDatabaseWithUrl('https://example.firebaseio.com');Example 2
// Get the Database service for a specific appconstotherDatabase=getDatabaseWithUrl('https://example.firebaseio.com',app);enableLogging
enableLogging function from the@firebase/database-compat package.
Signature:
enableLogging:typeofrtdb.enableLoggingServerValue
ServerValue constant from the@firebase/database-compat package.
Signature:
ServerValue:rtdb.ServerValueExcept 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.