Mongoose – 只返回一个数组的内容,而不是它的名字

我从我的Mongoose查询返回这样一个JSON:

[{ "messages": [{ "body": "this is the body", "sender": "John", "_id": "56ffbabb9a984f0804e8b3a0" }, { "body": "message body", "sender": "Jake", "_id": "56ffc60c68a75ab835a7e097" }] }] 

我想获得这个(只有一个数组的内容,没有它的名字):

 [{ "body": "this is the body", "sender": "John", "_id": "56ffbabb9a984f0804e8b3a0" }, { "body": "message body", "sender": "Jake", "_id": "56ffc60c68a75ab835a7e097" }] 

查询现在看起来如下所示:

 var query = Messages.find({_id: id}).select('-_id -__v'); query.exec(function(err, messages){ if(err) res.send(err); res.json(messages); }); 

我应该改变什么来获得所需的输出?

尝试:

 // change .find to .findOne to get just the one record you want var query = Messages.findOne({_id: id}).select('-_id -__v'); query.exec(function(err, message){ if(err) res.send(err); // return just the .messages collection within the selected message res.json(message.messages); });