Documentation

    How to use Firestore Studio, from the first connection to restoring a change.

    Security rules, databases and backups

    Edit and publish security rules

    Change the Firestore rules of a database, on Google or on an emulator.

    1. Step 1: Expand a database in the sidebar and choose Rules, or use the Security rules button in a collection toolbar. A Rules tab opens with the project and database selected.
    2. Step 2: Edit the rules in the editor. The label Unsaved changes appears when the text differs from what is published.
    3. Step 3: Choose Publish. The app asks Publish Firestore security rules? and names the database and project.
    4. Step 4: Confirm. The new ruleset replaces the published rules for every client.
    • Reload replaces the editor text with the published rules. If you have unsaved changes it asks first.
    • If the database has no published rules yet, the app shows a default template and says No published rules yet.
    • If the rules have errors, publishing is refused and the app lists them with line and column.
    • Cmd/Ctrl+S asks to publish with the same confirmation. It never publishes directly.
    • When the button reads Up to date, the editor matches the published rules.

    Warning: Switching database or project with unpublished changes opens Unsaved security rules with Keep editing, Publish & switch and Discard. Publishing changes who can read and write your data. The app has no rules test tool or version history, so test rules in an emulator first.

    On an emulator connection the Rules tab shows the rules the emulator enforces. There is no project selector and no console link.

    • Validate compiles the rules in the editor without applying them. Errors show with line and column, and a clean result says The rules compile.
    • Apply to emulator replaces the rules the running emulator enforces for that database. It changes only the emulator memory: the rules file on disk is not changed, and the rules are lost when the emulator restarts.
    • For Storage, the emulator cannot report its rules. The app shows a template, and applying replaces the rules for the whole Storage emulator, every bucket.

    Database info and settings

    See a database and change its protection settings.

    Choose Database info & settings from the database menu or toolbar. The dialog shows Type, Location, Edition, Concurrency, PITR (Point In Time Recovery), Delete protection, Encryption (with the KMS key when you use one), Created, Updated and the resource tags. PITR and Delete protection each have an Enable or Disable button, and the dialog ends with Delete database.

    The database toolbar and context menu also offer Enable PITR and Disable PITR, Enable Delete Protection and Disable Delete Protection, Clone database, Backup & Restore, Create New Collection and Reveal in Firebase Console.

    • Enable PITR keeps a 7-day version history. Storage costs may apply.
    • Disable PITR discards all snapshot data and you can no longer read or recover past states. You must type the database ID to confirm.
    • With Delete protection on, the database cannot be deleted until you turn it off. The database icon is drawn in a warning color.

    Note: Changes to PITR and delete protection can take a while on Google. If the operation is still running, the app says the change started and shows the result when it finishes. An emulator does not offer these settings.

    Create, clone and delete a database

    Add a database, copy one from a snapshot, or remove one.

    1. Step 1: Select the project, expand Firestore in the sidebar and choose Create database (or Create Database from its menu).
    2. Step 2: In Create Firestore Database, type the Database ID. It must be 4 to 63 characters, start with a letter, end with a letter or number and contain only lowercase letters, numbers and hyphens.
    3. Step 3: Choose the Database Edition: Enterprise Native or Firestore Standard.
    4. Step 4: Choose the Location. A location is shown with Google's name, for example northamerica-northeast1 (Montréal).
    5. Step 5: Choose Encryption: Google-managed encryption, or Customer-managed encryption (CMEK) with a KMS key name. The key must be in the same location and cannot be changed after creation, and it requires the Cloud KMS API, which is a paid service.
    6. Step 6: Optional: add Tags as key1=value1,key2=value2. Binding tags needs the Tag User role.
    7. Step 7: Confirm. Creation can take several minutes. The app tells you when the database is created.

    Note: Creating a database is not available on an emulator. The ID and the location cannot be changed later. Enterprise Native is the edition that supports Pipeline queries.

    To clone a database from a point-in-time snapshot:

    1. Step 1: Choose Clone database from the database toolbar or menu.
    2. Step 2: In Clone database from PITR snapshot, type the Target database ID and pick the Snapshot time (PITR).
    3. Step 3: Choose Encryption and optional Tags, then Clone database. Cloning can take several minutes.

    Cloning needs the datastore.databases.clone permission (the Owner or Datastore Owner role). Without it the app says so.

    To delete a database, open Database info & settings, turn Delete protection off if it is on, and choose Delete database. The app asks you to continue and then to type the database ID.

    Warning: Deleting a database permanently deletes all its documents, indexes and backup schedules. It cannot be undone. Take or check a backup first.

    Backups, schedules and restore

    List, schedule, delete and restore backups of a database.

    1. Step 1: Choose Backup & Restore from the database toolbar or menu. A tab opens with the project and database selected.
    2. Step 2: Change the project or database with the selectors at the top. MongoDB-compatible databases are not listed.
    3. Step 3: The Backups tab lists backups with Backup ID, Source DB, Location, Snapshot, Expires, State and Size. Filter by Database and use Refresh.

    Use Delete backup on a row to remove it. The app asks first, and a deleted backup cannot be recovered.

    The Schedules tab lists backup schedules with Schedule ID, Recurrence, Retention and Created. Under Add a new schedule choose Daily or Weekly, set Retention (days) from 1 to 98 and choose Add schedule. Edit retention changes the retention only. To change the recurrence, delete the schedule and add a new one. Delete schedule stops future backups and does not touch existing ones.

    Note: Backups and schedules are not available on an emulator, and the app does not offer creating a single backup on demand. Backups and scheduling are listed on every plan.

    To restore a backup into a new database:

    1. Step 1: In the Backups tab, choose Restore from this backup on a backup. The button is disabled with Backup not ready until the backup is ready.
    2. Step 2: The dialog Restore database from backup shows the backup, source database, location and snapshot.
    3. Step 3: Type the Target database ID. It must not exist. It must be 4 to 63 characters, lowercase letters, numbers and hyphens.
    4. Step 4: Choose Encryption and optional Tags, as when you create a database.
    5. Step 5: Choose Restore and wait. A restore can take several minutes.

    Note: The restore creates a new database next to the source, so the live data is not touched. If the source database no longer exists, the backup shows its internal ID. A permission error for customer-managed keys or tags includes links to Cloud KMS and Tag Manager.

    Time-travel and restoring from a past time

    Read documents as they were and put them back.

    With point-in-time recovery enabled, you can read a collection as it was at an earlier time and restore documents from it. The time must be between 1 minute and 7 days ago, on a whole minute.

    1. Step 1: In a collection tab, choose the time-travel button (tooltip Time-travel (PITR)).
    2. Step 2: In the popover Read documents at a past time, pick a time with the slider or a custom time, and choose Enter time-travel.
    3. Step 3: The toolbar shows Time-travel: with the time. The grid is read-only and realtime is off.
    4. Step 4: Choose Change time to move, or Exit to return to live data.
    • Row menu View at past time opens one document as it was. Compare and Restore with live shows the differences and, after you confirm, overwrites the live document with the past version.
    • With rows selected, More, Restore to live restores the selected documents. Documents that did not exist at that time are skipped. The action is recorded in the audit log.
    • Restore entire collection… overwrites every live document of the collection with its state at that time, without needing a query first. On a collection group tab it covers every collection with that ID.

    Warning: Restoring overwrites live documents. It runs as a background task. Time-travel is not available in Pipeline mode, on an emulator, or on a database without PITR.