From the docs:
You can also chain multiple where() methods to create more specific queries (logical AND).
How can I perform an <
This doesn't solve all cases, but for "enum" fields, you can emulate an "OR" query by making a separate boolean field for each enum-value, then adding a where("enum_
for every value that isn't part of the "OR" clause you want.
For example, consider your first desired query:
- Give me all documents where the field status is open OR upcoming
You can accomplish this by splitting the status: string
field into multiple boolean fields, one for each enum-value:
status_open: bool
status_upcoming: bool
status_suspended: bool
status_closed: bool
To perform your "where status is open or upcoming" query, you then do this:
where("status_suspended", "==", false).where("status_closed", "==", false)
How does this work? Well, because it's an enum, you know one of the values must have true
assigned. So if you can determine that all of the other values don't match for a given entry, then by deduction it must match one of the values you originally were looking for.