I have a document that has a array of ObjectIDs for reference. That array is not an associative array, it's just the ObjectIDS:
{
...
"tags" : [
ObjectId("54744662ae8a0be602568c4f")
]
}
Now I'm trying to filter based on that array, like this:
db.expenses.find({
tags:{
$elemMatch:{ObjectId("547469bb0bde915a05f74299")}
}
})
I know that the projection on the $elemMatch is wrong, but I just don't know how to do it, and Google isn't helping must because most of the examples are for and array of json objects with defined properties.
Does anyone know how to do this?