firebase. database
database
database(app) returns firebase.database.Database
Gets the Database service for the default app or a given app.
firebase.database() can be called with no arguments to access the default app's Database service or as
firebase.database(app) to access the
Database service associated with a specific app.
firebase.database is also a namespace that can be used to access global constants and methods associated with the Database service.
Parameter |
|
|---|---|
|
app |
Optional Optional app whose Database service to return. If not provided, the default Database service will be returned. Value must not be null. |
- Returns
-
non-null firebase.database.DatabaseThe default Database service if no app is provided or the Database service associated with the provided app.
Examples
// Get the Database service for the default app
var defaultDatabase = firebase.database();
// Get the Database service for a specific app
var otherDatabase = firebase.database(app);
Interfaces
Database
DataSnapshot
OnDisconnect
Query
Reference
ThenableReference
Namespace
ServerValue
Method
enableLogging
enableLogging(enabled, persistent)
Logs debugging information to the console.
Parameter |
|
|---|---|
|
enabled |
Optional boolean Enables logging if |
|
persistent |
Optional boolean Remembers the logging state between page refreshes if |
Examples
// Enable logging
firebase.database.enableLogging(true);
// Disable logging
firebase.database.enableLogging(false);
// Enable logging across page refreshes
firebase.database.enableLogging(true, true);

