The Firebase Database service is available for the default app or a given app.
Get the database instance for the default app:
const databaseForDefaultApp = firebase.database();
Get the database instance for a secondary app:
const otherApp = firebase.app('otherApp'); const databaseForOtherApp = firebase.database(otherApp);
FirebaseApp instance for this Firebase service.
Disconnects from the server (all Database operations will be completed offline).
Reconnects to the server and synchronizes the offline Database state with the server state.
Reference representing the location in the Database corresponding to the provided path.
If no path is provided, the Reference will point to the root of the Database.
ref(path?: undefined | string): Reference;
Reference representing the location in the Database corresponding to the provided Firebase URL.
refFromURL(url: string): Reference;
Sets the native logging level for the database module. By default, only warnings and errors are logged natively. Setting this to true will log all database events.
setLoggingEnabled(enabled: boolean): Promise<void>;
By default Firebase Database will use up to 10MB of disk space to cache data. If the cache grows beyond this size, Firebase Database will start removing data that hasn't been recently used. If you find that your application caches too little or too much data, call this method to change the cache size. This method must be called before creating your first Database reference and only needs to be called once per application.
setPersistenceCacheSizeBytes(bytes: number): Promise<void>;
Sets whether persistence is enabled for all database calls for the current app instance.
setPersistenceEnabled(enabled: boolean): Promise<void>;