Overview: Cloud Firestore Solutions

As you develop your app with Cloud Firestore, you might want to go beyond the basics discussed in the manage and query data sections. The solutions outlined in this section offer guidance on more advanced use cases.

Working with arrays, lists, and sets

Summary: Store and query data in array-like structures in documents.

Use case: If your app requires complex data objects like arrays, lists, or sets, follow the model outlined in this solution. For example, in a blogging app, you might want to create a set of related posts.

See the solution for working with arrays, lists, and sets

Aggregation queries

Summary: Build an aggregate of your data in Cloud Firestore using transactions and Cloud Functions.

Use case: To query your data across collections, build an aggregate, then run the query. For example, in a recommendations app, you might want to retrieve all the information for a particular restaurant from different collections.

See the solution for aggregation queries

Distributed counters

Summary: Distribute updates across "counter" subcollections to update a document more frequently than Cloud Firestore currently supports.

Use case: Use this solution to add "counters" to your app (for example, to represent upvotes), and update the corresponding document at a high frequency. Cloud Firestore supports 2 writes/second on each document.

See the solution for distributed counters

Summary: Search for text contained in your Cloud Firestore documents.

Use case: Users might want to search your app content, including text contained in individual fields across your documents and collections. Use this solution to enable full-text search.

See the solution for full-text search

Build presence

Summary: Add a presence system that identifies whether or not a user is actively connected.

Use case: Use this solution to identify users that are actively connected to your app. For example, in a chat app, you might use a presence system to populate a list of users that are online.

See the solution for building presence

Securing Data Access for Users and Groups

Summary: Write security rules to control access to individual documents based on user roles.

Use case: Use this solution to build collaborative apps while minimizing the risk of improper data access.

See the solution for secure data access

Send feedback about...

Need help? Visit our support page.