Io uso la seguente query mangusta in un ambiente MEAN per trovare ed emettere un particolare autore e i suoi libri corrispondenti.Mongoose/Mongodb: esclude i campi dai dati di query popolate
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
});
Vorrei anche di escludere il "_id" e "__v" campi dai dati popolate provenienti dai documenti esterni. Come può essere realizzato?
grande! molte grazie. funziona bene =) –