0
var schema = new mongoose.Schema({
name: { type: String, require: true },
comments: [{
id: {type: Schema.Types.ObjectId, ref: 'Comment'},
vote: Number,
}],
creator: {type: Schema.Types.ObjectId, ref: 'User'},
я могу заполнить creator
, но не может заполнить comment
Как заполнить субдокумент другими полями в мангусте?
Posts
.findOne({ id: id })
.populate('creator')
.populate('comments')
.exec(function (err, post) {
});