Skip to content Skip to sidebar Skip to footer

Query On Wildcard Document Id

Is that possible to filter document id based on date? For example, documents are inserted daily and we want to delete the previous date data. We planned to append date along docume

Solution 1:

perform deletion with filtering on document ID with wildcard - 20181101_*

There is no way in Cloud Firestore to create a query based on wildcards.

delete all the document which their id start with some matching date.

There is also no way in which you can query elements in a Firestore database that start with some matching date. To solve this, you should follow the instructions from the official documentation which says:

Cloud Firestore doesn't support native indexing or search for text fields in documents. Additionally, downloading an entire collection to search for fields client-side isn't practical.

To enable full text search of your Cloud Firestore data, use a third-party search service like Algolia.

And yes, you are guessing right, the best solution is to to add a new date property and to query the database according to it.

Post a Comment for "Query On Wildcard Document Id"