-4
rated 0 times
[
3]
[
7]
/ answers: 1 / hits: 32898
/ 10 Years ago, thu, november 13, 2014, 12:00:00
I use the following mongoose query in a MEAN-environment to find and output a particular author and his corresponding books.
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
});
I would also like to exclude the _id and __v fields from the populated data coming from the external documents. How can that be achieved?
More From » node.js