我想从我的 Node.js 应用程序中的 Mongoose 设置中检索一些数据。我注意到无论我写什么作为字段选择,我总是得到 _id
字段。有办法不取吗?这就是我现在的做法:
Transaction.find({username : user.username}, ['uniqueId', 'timeout', 'confirmation_link', 'item_name'], function(err, txs){
console.log("user : " + user.username + " with txs: " + txs);
callback(txs);
});
并记录包含 _id
字段的结果。
原文由 Masiar 发布,翻译遵循 CC BY-SA 4.0 许可协议
_id
必须明确排除。例如,