Using multiple instances of Firestore in the same project

2,326 views
Skip to first unread message

John Pereira

unread,
Nov 1, 2018, 3:47:05 AM11/1/18
to Firebase Google Group
Hello all,

I'm building a new app in Firebase and Firestore. The app is built around the concept of Teams and most of the data is scoped within a Team (think Trello where a project is owned by a Team and Team members collaborate on the project)

One of the features I'm considering is having user data for a Team be silo'd within one instance of a Firestore DB. So each Team would have its own instance of Firestore. Is this possible to do?


Samuel Stern

unread,
Nov 1, 2018, 5:24:39 AM11/1/18
to fireba...@googlegroups.com
Hey John,.

Right now you can only have one Firestore database per project.  In the future we could enable multiple databases (you can see that the protocol already supports this) but it's not in our immediate plans.

However you may be able to use subcollections to simulate this type of structure.  Imagine a top-level collection called "teams" where each team has a document.  You can then create totally separate subcollection trees under each team document.  This will have similar performance to using totally separate databases, but you'll approach the system limits sooner since the load of all teams would be combined.

- Sam

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/c1a711a5-1ff7-4b98-aa30-3417f6802b9e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Guy Rom

unread,
Nov 1, 2018, 11:10:47 AM11/1/18
to Firebase Google Group
If you are good with subcollections like advised go for it.
In my case I needed 2 separate DBs which requires 2 projects but it can be done. However, you'll need to provide the credentials of the second project to the function in order to access the second DB.
Reply all
Reply to author
Forward
0 new messages