From the docs:
You can also chain multiple where() methods to create more specific queries (logical AND).
How can I perform an OR query? Example:
status is open OR upcoming status == open OR createdAt <= <somedatetime> Cloud Firestore does not support the equivalent of SQL's update queries.
OR isn't supported as it's hard for the server to scale it (requires keeping state to dedup). The work around is to issue 2 queries, one for each condition, and dedup on the client.
Edit (Nov 2019):
Cloud Firestore now supports IN queries which are a limited type of OR query.
For the example above you could do:
// Get all documents in 'foo' where status is open or upcmoming db.collection('foo').where('status','in',['open','upcoming']).get() However it's still not possible to do a general OR condition involving multiple fields.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With