Let's say I have an array of objects (let us call that array A) and I need a query to find a collection in MongoDB for all documents matching one of it's fields to one of the properties of object 1 in array A and another field to some other property in the same object in array A.
The documents do not have all the properties that the objects in array A have.
To make things clear...
Array A would look something like this...
[{
id_bus:1,
id_bus_variation:13,
....
},{
id_bus:2,
id_bus_variation:184,
....
},{
id_bus:3,
id_bus_variation:13,
....
}]
The documents in my database include those two properties and I need to match those two at the same time. For example, I need to find in my database the docs that have id_bus == 1 and id_bus_variation == 13, and also the ones that have id_bus == 2 and id_bus_variation == 184 but not the ones that id_bus == 4 and id_bus_variation == 13.
I really don't have any idea of how to do this using a single query, the only way around it I found is to go through array A and execute a query for each of it's elements, matching all the fields I need, but that doesn't seem efficient.