The _id field _id always present unless you explicitly exclude it. Do this using the syntax - :
exports.someValue = function(req, res, next) { //query with mongoose var query = dbSchemas.SomeValue.find({}).select('name -_id'); query.exec(function (err, someValue) { if (err) return next(err); res.send(someValue); }); };
Or explicitly through the object:
exports.someValue = function(req, res, next) { //query with mongoose var query = dbSchemas.SomeValue.find({}).select({ "name": 1, "_id": 0}); query.exec(function (err, someValue) { if (err) return next(err); res.send(someValue); }); };
Neil Lunn Jun 22 '14 at 6:09 a.m. 2014-06-22 06:09 a.m.
source share