swipe
swipe11mo ago

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:
Hi @swipe, You can try with this workflow template. It uses the custom filter logic to support OR query, thanks to @Luis. 🎉
Jump to solution
3 Replies
Gaurav Chadha
Gaurav Chadha11mo ago
Should be possible, we'll take a look. Thanks for mentioning along with example snippet.
swipe
swipeOP8mo ago
@Gaurav Chadha would appreciate any suggestions
Solution
Gaurav Chadha
Gaurav Chadha8mo ago
Hi @swipe, You can try with this workflow template. It uses the custom filter logic to support OR query, thanks to @Luis. 🎉