【发布时间】:2011-11-07 06:29:41
【问题描述】:
我有这个文档存储在 mongodb 文档中:
{
"_id":ObjectId("4eb7642ba899edcc31000001")
"hash":"abcd123"
"value":"some_text_here"
}
我正在使用 NodeJS 访问数据库:
collection.findOne({'hash' : req.param('query') },
function(err, result){
console.log(res);
});
此查询的结果是整个文档,但我只需要获取“值”文本:“some_text_here”
如何做到这一点?
【问题讨论】: