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.
You can use $in operator:
collection.find({ "name": { "$in": ["Jollibee", "Mcdo"] }})
name property is equal to the object {"Jollibee", "Mcdo"}, and that is not valid. If you want to find multiple values for a property, you can either use $or operator for each value explicitly, or $in operator that takes an array of all the values that you are interested.