I would like to find name with alexa in nested object Playground: https://mongoplayground.net/p/rqYQtf0liaX
[
{
item: "journal",
instock: [
{
warehouse: "A",
qty: 5,
items: null
},
{
warehouse: "C",
qty: 15,
items: [
{
name: "alexa",
age: 26
},
{
name: "Shawn",
age: 26
}
]
}
]
}
]
What i have tried so far and this returns no document found
db.collection.find({
"instock.items": {
$elemMatch: {
name: "Alexa"
}
}
})