I have a Mongo db collection of documents which contains _id , version and many other fields. I have an array of id's like :
["1A", "2b", "3C", "4D"]
If I want all the documents that contain any of the above id's, i could query like :
{
_id : {
$in: ["1A", "2b", "3C", "4D"]
}
}
I'd like to know if we can query with another condition in addition to the _id i.e the above array with condition, something like below :
{
$in: [{"id":"1A","version":"1.1"},{"id":"2B","version":"2.1"},{"id":"3C","version":"3.1"},{"id":"4D","version":"4.1"}]
}
}
Example for {"id":"1A","version":"1.1"} : I want all the documents that has id as 1A and version as 1.1. Similarly for all the objects in the array.