Home > Mobile >  What is the purpose of the "databases" line here in this Firestore security rule?
What is the purpose of the "databases" line here in this Firestore security rule?

Time:01-04

In the documentation bout recursive wildcards: https://firebase.google.com/docs/firestore/security/rules-structure#recursive_wildcards

We have the following:

service cloud.firestore {
  match /databases/{database}/documents {
    // Matches any document in the cities collection as well as any document
    // in a subcollection.
    match /cities/{document=**} {
      allow read, write: if <condition>;
    }
  }
}

What is the purpose of the line match /databases/{database}/documents {? I thought I could only create one database per project in Firestore. Does this mean I can create database A and database B within the same project? Do I even need this line if I only want to have 1 database?

CodePudding user response:

firebaser here

Currently you can indeed only have one Firestore database per project, but that may change in the future. At that point, the {database} variable can be used to differentiate between the database instances in your project.

  • Related