【发布时间】:2015-01-10 23:11:39
【问题描述】:
我在 MEAN 环境中使用以下 mongoose 查询来查找和输出特定作者及其对应的书籍。
Author
.findOne({personcode: code})
.select('-_id')
.select('-__v')
.populate('bookids') //referencing to book documents in another collection (->array of bookids)
.select('-_id') //this doens't affect the data coming from the bookids-documents
.select('-__v') //this doens't affect the data coming from the bookids-documents
.exec(function (err, data) {
//foo
});
我还想从来自外部文档的填充数据中排除“_id”和“__v”字段。如何实现?
【问题讨论】:
标签: javascript node.js mongodb mongoose