rules. firestore
            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()).
Interfaces
Request
The incoming request context for a Firestore operation.
Resource
The Firestore document being read or written.
Properties
request
non-null rules.firestore.Request
The request context, including authentication information and pending data.
resource
non-null rules.firestore.Resource
The resource being read or written.
Methods
exists
exists(path) returns rules.Boolean
Check if a document exists.
                      Parameter | 
                  |
|---|---|
| 
                         path  | 
                      
                        
                         The path. Value must not be null.  | 
                    
- Returns
 - 
                  
non-null rules.Booleantrue if the resource exists. 
Example
// Check if another document exists
allow write: if exists(/databases/$(database)/documents/things/other)existsAfter
existsAfter(path) returns rules.Boolean
Check if a document exists, assuming the current request succeeds. Equivalent to getAfter(path) != null.
                      Parameter | 
                  |
|---|---|
| 
                         path  | 
                      
                        
                         The path. Value must not be null.  | 
                    
- Returns
 - 
                  
non-null rules.Booleantrue if the resource exists. 
get
get(path) returns rules.firestore.Resource
Get the contents of a firestore document.
                      Parameter | 
                  |
|---|---|
| 
                         path  | 
                      
                        
                         The path. Value must not be null.  | 
                    
- Returns
 - 
                  
non-null rules.firestore.Resourcethe document, or null if it does not exist. 
Example
// Get the 'thing1' document from the 'things' collection
get(/databases/$(database)/documents/things/thing1)getAfter
getAfter(path) returns rules.firestore.Resource
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.
                      Parameter | 
                  |
|---|---|
| 
                         path  | 
                      
                        
                         The path. Value must not be null.  | 
                    
- Returns
 - 
                  
non-null rules.firestore.Resourcethe document, or null if it does not exist.