【发布时间】:2014-11-08 06:57:24
【问题描述】:
我有下一个架构:
var eventSchema = mongoose.Schema({
title: 'string',
propietary_id: 'String',
comments : [{
text: 'string',
user: { type : mongoose.Schema.Types.ObjectId, ref : 'users' },
createdAt: {type: Date, default: Date.now }
}]
});
我的查询:
Event.find().populate('comments.user').exec(function(err, doc){
console.log(err);
console.log(doc);
});
有可能返回带有事件信息、2 个 cmets 和 cmets 总数(如 facebook)的对象吗?
【问题讨论】:
标签: express