I faced many limitations with Firestore:
not-in
not-in
with in
, array-contains-any
, or or
in the same querySo I basically thought about changing data structure and use maps since they can be queried via field.key
.
the key field
of every document is not dynamic but each key
of the map is.
this is an example of my structure:
// the collection
animals
// the document (random id)
dog
// the field (a map value)
food: {
1: true
2: true
3: true
}
The question the query should answer is: "Give me every record where a specific value does not exist AND (other constraints)"
I am considering changing stack for this project because of this. Any good advice is also welcome.
All Firestore queries are based on a reference to the document being present in the index(es) used for the query.
If a document doesn't have a value for a certain field, it won't be present in an index on that field.
This implies that you can't query for documents that don't have a value for the field you want to query on.