Home > Enterprise >  OR operator in .where AngularFire
OR operator in .where AngularFire

Time:08-17

I want to get data from firebase .where()
for example: get data from database with attributes type = 'shirt' and type = 'pants'
So, essentially an OR operator in a .where function in AngularFire Firestore
Similar to '||' in a JavaScript IF statement

CodePudding user response:

you can use where operator as follows.
this.firestore .collection(orgId) .doc('VEHICLES') .collection('LOCATION_CHANGES', ref => ref.where('containerId', '==', containerId).limit(1));

CodePudding user response:

If you want to check whether a specific field in your documents has one of multiple values, you can use the in operator of Firestore.

So something like:

where('type', 'in', ['shirt', 'pants'])
  • Related