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)
Make use of the $or operator.
db.table.find({$or:[{"groupA":data},{"groupB":data}]}, function(err,data){
})
Use the $or operator in your query:
db.table.find({$or:[{"groupA": data}, {"groupB": data}]},
function(err, records){
//code to be executed.
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With