{
_id:"101",
title : "this is title",
comments:
[{
username : "mark zucker",
comment: "awsome"
}]
}
我试图用用户名"标记zucker"来获得评论。通过以下代码
app.get('/all',function(req , res){
db.collection.find({"_id":101},{"comments.username":'mark zucker'},function(err,docs){res.send(docs,{data:docs});});
} );
但我得到的输出为
{
"data": [
{
"_id": 101,
"comments": [
{
"user": "mark zucker"
},
{
"user": "bella"
}
]
}
]
}
请帮助我只使用用户名获得特定评论:" mark zucker"