Image for post
Image for post

Firebase Plugin update: Firestore collection group queries and increment

React Studio
Sep 4, 2019 · 3 min read

We’ve released major update to React Studio’s ( Firebase data plugin. You’ll get the update by opening your React Studio app and going into Plugins->Plugin manager and then click update next to Firebase plugin.

If you don’t have Firebase plugin installed then open the Plugin Store and install the plugin package there for free.

Whats new?

  • Cloud firestore Increment interaction
  • Cloud firestore Collection group queries
  • Set document name when creating a new document

Collection group queries

Collection group queries are really handy when you have collections inside documents. For example you could have Restaurant document and inside restaurant document you have “reviews” collection. It works well until you want to list reviews from more than one restaurant.

Cloud Firestore’s database now has a solution for querying between nested collections which is called Collection group query and React Studio is now supporting this feature. Just type prefix “group:” to Collection Id field in Data sheet and plugin will make collection group query instead of normal query.

Note that you need to update your Cloud Firestore’s database security rules to version 2.0 to be able to use Collection group queries:

Image for post
Image for post

Read more about Collection group queries from Firebase’s own blog:

Increment field value (e.g. creating a “Like” button)

Incrementing field value may be quite painful because you needed to use transactions for making sure transaction to keep data safe from concurrent writes. now you can use “increment” which will take care of queuing simultaneous increments when thousands of users are updating the same data.

You’ll find the increment in “Save data” -> Plugin interaction. In the screen shot below the increment interaction is used for creating Like and Unlike buttons for chat message.

Image for post
Image for post
Typical Like and Unlike buttons created with Increment interaction. You may test the example app here:

Set document name (create only)

In some cases it is wise to name the document instead of using Firestore’s automatic UUID as the document name. The reason could be e.g. that you want to create User document and use unique User Id as a name for the document. This way you can refer to document fast with just creating a path to document using Firebase Login’s user id. This also helps when making rules for user document. One can simply deny access if user’s id is not same as document name.

Set the document name in Save data interaction by using the “Document_Key” “column”. This sets the name when adding a new document to database. Please not that once you’ve created the document you cannot change the name anymore.

Image for post
Image for post
Setting the document name in Cloud Firestore database

Feel free to send us future development ideas for Firebase plugins to or post your ideas into our discussion forum at

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store