Reputation: 167
I am trying to query my mongodb
but I don't know which row my data is under so i am trying to querying both rows with parameters, is this syntax correct?
db.table.find({groupA: data} || {groupB: data}, function(err, records)
Upvotes: 9
Views: 13440
Reputation: 113
Use the $or operator in your query:
db.table.find({$or:[{"groupA": data}, {"groupB": data}]},
function(err, records){
//code to be executed.
});
Upvotes: 4