Code Snippets Generator
Don't Forget

Always add a "Collection Name" and a "Variable"!


Step 1

Choose your "Firestore Settings".


Step 2

Add your keys.
- "Not Empty" will check if: YOUR_KEY != ''
- "Required Key" works with the "Keys Checking" from "Firestore Settings" and will make sure this key is required to be in your Firestore document.


Step 3

Copy the code and add it to your Firestore Rules file.
- JS Validation (Basic) returns true if the conditions are met.
- JS Validation (Advanced) returns false if the conditions are not met and returns an error-statement.

Video

Check out the video for a full explanation.

Firestore Settings

e.g. users or directory


e.g. owner or createdBy




Firestore limits writes to 1/s by default

e.g. lastUpdate or timestamp

Add Keys

In camelCase 🐫


Add Keys

In camelCase 🐫

Items

    Add Keys

Firestore Validation
    match /<ADD-COLLECTION-NAME>/{itemId}{

      allow read: if //add validation or remove

      allow create: if //add validation or remove

      allow update: if //add validation or remove

      allow delete: if //add validation or remove

      // FUNCTIONS
    }


JS Validation (Basic)
function isValid(<ADD-VARIABLE>) {
  return (
  );   
}
JS Validation (Advanced)
function isNotValid(<ADD-VARIABLE>) {
  
  } else return false;
}