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.
example
// Get the Database service for the default appvar defaultDatabase = firebase.database();
example
// Get the Database service for a specific appvar otherDatabase = firebase.database(app);
// Enable logging across page refreshes
firebase.database.enableLogging(true, true);
example
// Provide custom logger which prefixes log statements with "[FIREBASE]"
firebase.database.enableLogging(function(message) {
console.log("[FIREBASE]", message);
});
Parameters
Optional logger: boolean | ((a: string) => any)
Enables logging if true;
disables logging if false. You can also provide a custom logger function
to control how things get logged.
Optional persistent: boolean
Remembers the logging state between page
refreshes if true.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2022-07-27 UTC."],[],[]]
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'sDatabase
service or asfirebase.database(app)
to access theDatabase
service associated with a specific app.firebase.database
is also a namespace that can be used to access global constants and methods associated with theDatabase
service.// 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);