I have a mongo collection where each document look something like this:
{
title: "blah blah",
stuff: [
{
id:"001",
data:"blah blah blah"
},
{
id:"002",
data:"bleeh blah blooh"
},
{
id:"003",
data:"bow wow wow"
}
]
}
I want to find all documents where the 'stuff' array contains at least one object where 'id' is '001'.
My initial attempt was this:
db.mycollection.find({ stuff: [ { id: "001" } ] });
But evidently this is not correct.
What is the correct query?