Firebase complex queries (OR, AND)
The current firestore collection query allows for filters, but doesn't seem to support OR queries. Is that true? I'd love to be able to do something like:
val db = Firebase.firestore
val usersRef = db.collection("users")
val queryByAdminOrAge= usersRef.where(Filter.or(
Filter.equalTo("admin", true),
Filter.greaterThanOrEqualTo("age", 18)
))
or
val db = Firebase.firestore
val usersRef = db.collection("users")
val queryByAdminOrAge= usersRef.where(Filter.and(
Filter.equalTo("technology", "Firebase"),
Filter.or(
Filter.equalTo("admin", true),
Filter.greaterThanOrEqualTo("age", 18)
)
))
Solution:Jump to solution
Hi @swipe, You can try with this workflow template. It uses the custom filter logic to support OR query, thanks to @Luis. 🎉
3 Replies
Should be possible, we'll take a look. Thanks for mentioning along with example snippet.
@Gaurav Chadha would appreciate any suggestions
Solution
Hi @swipe, You can try with this workflow template. It uses the custom filter logic to support OR query, thanks to @Luis. 🎉