I have these type of items on mongodb:
{
"_id": { "$oid" : "2" },
"waypoints": [
{
"step": 0,
"coordinates": [1,2]
},
{
"step": 1,
"coordinates": [1,3]
},
{
"step": 2,
"coordinates": [1,4]
}
]
}
I tried to find [1,2] in the collection to retrieve waypoints.step and the _id, but the result is not what i expected.
I want to get:
{
"_id": { "$oid" : "2" },
"waypoints": [
{
"step": 0
}
]
}
but i get:
{
"_id": { "$oid" : "2" },
"waypoints": [
{
"step": 0,
},
{
"step": 1,
},
{
"step": 2,
}
]
}
what is the correct query to achieve what i want?
I know only the coordinates, i need to retrive _id of the object and the step corresponding to the coordinates I'm looking for.
thanks