The Firebase Realtime Database reference builder interface.Access via [functions.database.ref()](functions.database#.ref).
database.instance()
Registers a function that triggers on events from a specific Firebase Realtime Database instance.
Use this method together with ref to specify the instance on which to watch for database events. For example: firebase.database.instance('my-app-db-2').ref('/foo/bar')
Note that functions.database.ref used without instance watches the *default* instance for events.
Registers a function that triggers on Firebase Realtime Database write events.
This method behaves very similarly to the method of the same name in the client and Admin Firebase SDKs. Any change to the Database that affects the data at or below the provided path will fire an event in Cloud Functions.
There are three important differences between listening to a Realtime Database event in Cloud Functions and using the Realtime Database in the client and Admin SDKs:
Cloud Functions allows wildcards in the path name. Any path component in curly brackets ({}) is a wildcard that matches all strings. The value that matched a certain invocation of a Cloud Function is returned as part of the [EventContext.params](cloud_functions_eventcontext.html#params object. For example, ref("messages/{messageId}") matches changes at /messages/message1 or /messages/message2, resulting in event.params.messageId being set to "message1" or "message2", respectively.
Cloud Functions do not fire an event for data that already existed before the Cloud Function was deployed.
Cloud Function events have access to more information, including a snapshot of the previous event data and information about the user who triggered the Cloud Function.
[[["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 2023-04-24 UTC."],[],[],null,["Functions\n\nClasses\n\ndatabase.instance()\n\nRegisters a function that triggers on events from a specific Firebase Realtime Database instance.\n\nUse this method together with `ref` to specify the instance on which to watch for database events. For example: `firebase.database.instance('my-app-db-2').ref('/foo/bar')`\n\nNote that `functions.database.ref` used without `instance` watches the \\*default\\* instance for events.\n\n**Signature:** \n\n export declare function instance(instance: string): InstanceBuilder;\n\nParameters\n\n**Returns:**\n\n[InstanceBuilder](./firebase-functions.database.instancebuilder.md#databaseinstancebuilder_class)\n\nFirebase Realtime Database instance builder interface.\n\ndatabase.ref()\n\nRegisters a function that triggers on Firebase Realtime Database write events.\n\nThis method behaves very similarly to the method of the same name in the client and Admin Firebase SDKs. Any change to the Database that affects the data at or below the provided `path` will fire an event in Cloud Functions.\n\nThere are three important differences between listening to a Realtime Database event in Cloud Functions and using the Realtime Database in the client and Admin SDKs:\n\n1. Cloud Functions allows wildcards in the `path` name. Any `path` component in curly brackets (`{}`) is a wildcard that matches all strings. The value that matched a certain invocation of a Cloud Function is returned as part of the \\[`EventContext.params`\\](cloud_functions_eventcontext.html#params object. For example, `ref(\"messages/{messageId}\")` matches changes at `/messages/message1` or `/messages/message2`, resulting in `event.params.messageId` being set to `\"message1\"` or `\"message2\"`, respectively.\n\n2. Cloud Functions do not fire an event for data that already existed before the Cloud Function was deployed.\n\n3. Cloud Function events have access to more information, including a snapshot of the previous event data and information about the user who triggered the Cloud Function.\n\n**Signature:** \n\n export declare function ref\u003cRef extends string\u003e(path: Ref): RefBuilder\u003cRef\u003e;\n\nParameters\n\n**Returns:**\n\n[RefBuilder](./firebase-functions.database.refbuilder.md#databaserefbuilder_class)\\\u003cRef\\\u003e\n\nFirebase Realtime Database builder interface."]]