Search code examples
angulartypescriptfirebasegoogle-cloud-firestoreangularfire

OR operator in .where AngularFire


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


Solution

  • 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'])