Here is my code:
var DocSchema = new Schema({
clauseList: [{
type: Schema.ObjectId,
ref: 'Clause'
}],
user: {
type: Schema.ObjectId,
ref: 'User'
}
});
DocSchema.statics.load = function(id, cb) {
this.findOne({
_id: id
}).populate('user', 'name username').exec(cb);
};
I want to automatically load clauses list like loading the user. Help me please!
댓글 없음:
댓글 쓰기