0.1.2 • Published 9 years ago
mongoose-link v0.1.2
mongoose-link
Link related documents from a mongoose query.
This module provides an alternative way to populate related (linked) documents from a mongoose query.
It does not depend on _id
.
Install
$ npm install --save mongoose-link
Usage
var link = require('mongoose-link');
var Comment = require('./Comment');
var User = require('./User');
Comment.
find().
lean().
exec().
then(link.sync(User, 'created_by:user',{email:true}, {lean:true})).
then(function(comments) {
//Comments should look like {_id:'5325245af32e34634363', user:{email:'x@x.com'}}
})
License
Apache-2.0 © Lasana Murray