Reputation: 139
Select * from table_name where sport_type LIKE ('Cricket','Football');
I am trying to find the documents with sport_type
of Cricket and Football using find
table.find({ sport_type : "Cricket" })
Can anyone help me to do so
Upvotes: 5
Views: 7389
Reputation: 71
Maybe it's too late to answer but hopefully it will help other people.
You can use $in
operator, like this:
mongoose.find({sport_type: {$in: ['Cricket', 'Football']}})
You provide an array to $in
operator and it will return all the documents which have an exact sport_type in the array specified.
Upvotes: 3
Reputation: 14986
Try using $or
:
table.find( { $or:[ {'sport_type':'Cricket'}, {'sport_type':'Football'} ]},
function(err,docs){
// do something
});
Upvotes: 3