【发布时间】:2014-08-12 11:03:57
【问题描述】:
我正在尝试仅选择一个特定字段
exports.someValue = function(req, res, next) {
//query with mongoose
var query = dbSchemas.SomeValue.find({}).select('name');
query.exec(function (err, someValue) {
if (err) return next(err);
res.send(someValue);
});
};
但是在我的 json 响应中,我也收到了 _id,我的文档架构只有两个字段,_id 和 name
[{"_id":70672,"name":"SOME VALUE 1"},{"_id":71327,"name":"SOME VALUE 2"}]
为什么???
【问题讨论】:
标签: javascript node.js mongodb mongoose