Context specific variables and methods for Cloud Firestore
security rules.
Functions in this namespace are only available inside
service cloud.firestore { ... } blocks and
do not need to be prefixed when used (get()
not firestore.get()).
Get the projected contents of a document. The document is returned as
if the current request had succeeded. Useful for validating documents
that are part of a batched write or transaction.
[[["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 2019-12-13 UTC."],[],[],null,["# Namespace: firestore\n\n[rules](/docs/reference/rules/rules).firestore\n==============================================\n\nnamespace static\n\nContext specific variables and methods for Cloud Firestore\nsecurity rules.\n\nFunctions in this namespace are only available inside\n`service cloud.firestore { ... }` blocks and\ndo not need to be prefixed when used (`get()`\nnot `firestore.get()`).\n\nInterfaces\n----------\n\n### [Request](/docs/reference/rules/rules.firestore.Request)\n\nThe incoming request context for a Firestore operation.\n\n### [Resource](/docs/reference/rules/rules.firestore.Resource)\n\nThe Firestore document being read or written.\n\nProperties\n----------\n\n### request\n\nstatic\n\nnon-null [rules.firestore.Request](/docs/reference/rules/rules.firestore.Request)\n\nThe request context, including authentication information\nand pending data.\n\n### resource\n\nstatic\n\nnon-null [rules.firestore.Resource](/docs/reference/rules/rules.firestore.Resource)\n\nThe resource being read or written.\n\nMethods\n-------\n\n### exists\n\nstatic\n\nexists(path) returns [rules.Boolean](/docs/reference/rules/rules.Boolean)\n\nCheck if a document exists.\n\n| #### Parameter ||\n|------|----------------------------------------------------------------------------------|\n| path | [rules.Path](/docs/reference/rules/rules.Path) The path. Value must not be null. |\n\nReturns\n\n: `non-null `[rules.Boolean](/docs/reference/rules/rules.Boolean) true if the resource exists.\n\n#### Example\n\n // Check if another document exists\n allow write: if exists(/databases/$(database)/documents/things/other)\n\n### existsAfter\n\nstatic\n\nexistsAfter(path) returns [rules.Boolean](/docs/reference/rules/rules.Boolean)\n\nCheck if a document exists, assuming the current request succeeds. Equivalent\nto getAfter(path) != null.\n\n| #### Parameter ||\n|------|----------------------------------------------------------------------------------|\n| path | [rules.Path](/docs/reference/rules/rules.Path) The path. Value must not be null. |\n\nReturns\n\n: `non-null `[rules.Boolean](/docs/reference/rules/rules.Boolean) true if the resource exists.\n\n### get\n\nstatic\n\nget(path) returns [rules.firestore.Resource](/docs/reference/rules/rules.firestore.Resource)\n\nGet the contents of a firestore document.\n\n| #### Parameter ||\n|------|----------------------------------------------------------------------------------|\n| path | [rules.Path](/docs/reference/rules/rules.Path) The path. Value must not be null. |\n\nReturns\n\n: `non-null `[rules.firestore.Resource](/docs/reference/rules/rules.firestore.Resource) the document, or null if it does not\n exist.\n\n#### Example\n\n // Get the 'thing1' document from the 'things' collection\n get(/databases/$(database)/documents/things/thing1)\n\n### getAfter\n\nstatic\n\ngetAfter(path) returns [rules.firestore.Resource](/docs/reference/rules/rules.firestore.Resource)\n\nGet the projected contents of a document. The document is returned as\nif the current request had succeeded. Useful for validating documents\nthat are part of a batched write or transaction.\n\n| #### Parameter ||\n|------|----------------------------------------------------------------------------------|\n| path | [rules.Path](/docs/reference/rules/rules.Path) The path. Value must not be null. |\n\nReturns\n\n: `non-null `[rules.firestore.Resource](/docs/reference/rules/rules.firestore.Resource) the document, or null if it does not\n exist."]]