Firebase Plugin update: Firestore collection group queries and increment
We’ve released major update to React Studio’s (www.reactstudio.com) 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.
- 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: https://firebase.google.com/docs/rules/rules-behavior
Read more about Collection group queries from Firebase’s own blog:
Understanding Collection Group Queries in Cloud Firestore
Hey, there Firebase developers. Did you hear the exciting news? Last month at Google I/O, we announced support for…
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.
Incrementing Values Atomically with Cloud Firestore
Hey, there Firebase Developers! We wanted to let you know of a new feature we added to Cloud Firestore, and that's the…
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.
Feel free to send us future development ideas for Firebase plugins to email@example.com or post your ideas into our discussion forum at https://discuss.reactstudio.com/