Sets the specified rules on the Firebase Realtime Database instance. If the rules source is specified as a string or a Buffer, it may include comments.
Database.getRules()
Gets the currently applied security rules as a string. The return value consists of the rules source including comments.
Signature:
getRules():Promise<string>;
Returns:
Promise<string>
A promise fulfilled with the rules as a raw string.
Database.getRulesJSON()
Gets the currently applied security rules as a parsed JSON object. Any comments in the original source are stripped away.
Signature:
getRulesJSON():Promise<object>;
Returns:
Promise<object>
A promise fulfilled with the parsed rules object.
Database.setRules()
Sets the specified rules on the Firebase Realtime Database instance. If the rules source is specified as a string or a Buffer, it may include comments.
[[["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 2024-04-16 UTC."],[],[],null,["# Database interface\n\nThe Firebase Database service interface. Extends the [Database](https://firebase.google.com/docs/reference/js/v8/firebase.database.Database) interface provided by the `@firebase/database-compat` package.\n\n**Signature:** \n\n export interface Database extends FirebaseDatabase \n\n**Extends:** FirebaseDatabase\n\nMethods\n-------\n\n| Method | Description |\n|------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [getRules()](./firebase-admin.database.database.md#databasegetrules) | Gets the currently applied security rules as a string. The return value consists of the rules source including comments. |\n| [getRulesJSON()](./firebase-admin.database.database.md#databasegetrulesjson) | Gets the currently applied security rules as a parsed JSON object. Any comments in the original source are stripped away. |\n| [setRules(source)](./firebase-admin.database.database.md#databasesetrules) | Sets the specified rules on the Firebase Realtime Database instance. If the rules source is specified as a string or a Buffer, it may include comments. |\n\nDatabase.getRules()\n-------------------\n\nGets the currently applied security rules as a string. The return value consists of the rules source including comments.\n\n**Signature:** \n\n getRules(): Promise\u003cstring\u003e;\n\n**Returns:**\n\nPromise\\\u003cstring\\\u003e\n\nA promise fulfilled with the rules as a raw string.\n\nDatabase.getRulesJSON()\n-----------------------\n\nGets the currently applied security rules as a parsed JSON object. Any comments in the original source are stripped away.\n\n**Signature:** \n\n getRulesJSON(): Promise\u003cobject\u003e;\n\n**Returns:**\n\nPromise\\\u003cobject\\\u003e\n\nA promise fulfilled with the parsed rules object.\n\nDatabase.setRules()\n-------------------\n\nSets the specified rules on the Firebase Realtime Database instance. If the rules source is specified as a string or a Buffer, it may include comments.\n\n**Signature:** \n\n setRules(source: string | Buffer | object): Promise\u003cvoid\u003e;\n\n### Parameters\n\n| Parameter | Type | Description |\n|-----------|----------------------------|------------------------------------------------------------|\n| source | string \\| Buffer \\| object | Source of the rules to apply. Must not be `null` or empty. |\n\n**Returns:**\n\nPromise\\\u003cvoid\\\u003e\n\nResolves when the rules are set on the Realtime Database."]]