最佳答案
我试图只选择一个特定的字段
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"}]
为什么?