I am trying implement logical OR operator in firestore query.
db.collection('users').where('company_id', '==', companyId)
.where('role', '==', 'Maker')
.where('role', '==', 'Checker')
.where('role', '==', 'Approver')
.get().then(function(adminsSnapshot){
//Some processing on dataSnapshot
})
But this is not the right way to implement OR.
I want all users with roles of 'Maker, Checker or Approver'.
How would i implement OR in firestore query ? There's nothing in Doc.
There is no "OR" query in Cloud Firestore. If you want to achieve this in a single query you will need a single field like
maker_or_checker_or_approver: true
.Of course you can always do three queries and join them on the client.
You could combine the observables using rxjs, see angular(6) example below;