deep-populate
v1.0.0
Published
mongoose deep populate
Downloads
14
Maintainers
Readme
$npm install deep-populate
const deepPopulate = require('deep-populate');
const str = 'profile,system.user';
const populate = deepPopulate(str);
/* populate = [{
path: 'profile',
populate: '',
}, {
path: 'system',
populate: {
path: 'user',
populate: '',
},
}]; */
Story.
findOne({ title: 'Casino Royale' }).
populate(populate).
exec(function (err, story) {
if (err) return handleError(err);
console.log('The author is %s', story.author.name);
});