I have a collection with a document like this:
{
"name" : "some",
"items" : [
{"_id" : 0,
"name" : "item name"},
{"_id" : 2,
"name" : "item name"},
{"_id" : 0,
"name" : "item name"}
]
}
I want to select all documents where the the first index in items has an _id equal to 0.
Any ideas how to do this?
Thank you!
Edit:
I've tried this:
$items->find(array('items' => array('_id' => array('$ne' => 0))));
and
$items->find(array('items[0]' => array('_id' => array('$ne' => 0))));
Both return empty however.