skip to Main Content

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

2

Answers


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

    Login or Signup to reply.
  2. 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'])
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search