I am trying to figure out the best way to query mongo. I am using Mongoid and latest mongo version
What I want to do is query like this
user_id => [array of ids] and user_type => "some_type" OR user_id => [array of ids] and user_type => "some_type"
How can I do it in Mongo/Mongoid?
In mongo shell, it would be something like,
db.yourcollection.find({$or: [
{user_id: {$in: [array_of_ids]}, user_type: "some_type"},
{user_id: {$in: [array_of_ids2]}, user_type: "some_type2"}
]});
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