I have the following document structure:
{
\"_id\":\"12345\",
\"value\":{
\"T\":0,
\"v\":[
{
\"name\":\"JW\",
It's not clear exactly what you tried, but this should work to find the above doc by name
:
db.collection.find({ "value.v.name": "JW" })
Reference
You should use $elemMatch
operator:
db.collection.find({
'value.v': {
$elemMatch: {
name: 'JW', // "name == 'JW'"
cost : 100 //if you need "&& cost == 100"
}
}
});
Mongo docs