Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cloud Firestore wildcard for indexing

What is the syntax for a wildcard level in Cloud Firestore when setting up indexing? I know there is one for security rules.

Thanks.

like image 248
Blue Avatar asked Nov 07 '17 07:11

Blue


People also ask

How do you use wildcards in firestore?

There are no wildcards in Firestore paths to documents. You have to identify collections and documents by their IDs. If you need to find some documents based on some property, you'll need to do a query using some field value as a filter. You might be confused by wildcards in Cloud Functions trigger paths.

What file should be used for firestore indexes firestore indexes JSON?

From the CLI, edit your index configuration file, with default filename firestore. indexes. json , and deploy using the firebase deploy command.

What types of indexes are automatically created in cloud firestore?

Cloud Firestore uses two types of indexes: single-field and composite.


1 Answers

Cloud Firestore indexes are based on collection names, not full collection paths. So if you want to create indexes on users/{id}/messages, the correct way to do this is to create an index on messages.

All same-named collections, even if nested under documents, share the same indexes.

like image 127
Michael Bleigh Avatar answered Oct 14 '22 04:10

Michael Bleigh