Hello I have persons table
and I want to query 2 names at the same time to show their data.
I'm doing it like this
{"name":{"Jollibee", "Mcdo"}
but it is not working.
CodePudding user response:
You can use $in operator:
collection.find({ "name": { "$in": ["Jollibee", "Mcdo"] }})
CodePudding user response:
I am not an expert but you can use the OR condition, like
{"$or": [ { name: "Jollibee" }, { name: "Mcdo" } ] }
CodePudding user response:
You can also use implicit $and
collection.find( { $and: [ { name: { $eq: "Jollibee" } }, { name: { $eq: "Mcdo"} } ] } )
