{
_id:"101",
title : "this is title",
comments:
[{
username : "mark zucker",
comment: "awsome"
}]
}
i tried to get the comment with username "mark zucker" by this code below
app.get('/all',function(req , res){
db.collection.find({"_id":101},{"comments.username":'mark zucker'},function(err,docs){res.send(docs,{data:docs});});
} );
but i get the output as
{
"data": [
{
"_id": 101,
"comments": [
{
"user": "mark zucker"
},
{
"user": "bella"
}
]
}
]
}
please help me to get only the particular comment with username :"mark zucker" .