How to apply OR condition in collection query

this query match both variable shopid and type match in the query and gives the result ,however i want to match either shopid or type. basically it is OR condition don’t need to match both variable one of the mtach will be fine and results come out.

 let products = ProductApi.find({shopid:Session.get('shop')._id}).fetch();
1 Like

Hi,

Don’t know exactly what you are asking about but this is an example from mongodb about Or operator:

db.inventory.find( { $or: [ { quantity: { $lt: 20 } }, { price: 10 } ] } )

this is the page in the documentation:

https://docs.mongodb.com/manual/reference/operator/query/or/

3 Likes