比如有如下Schema
var Account = new Schema({
username: String,
password: String,
Email: String,
applyform: [{ type: ObjectId, ref: 'Applyform' }]
});
var Applyform = new Schema({
classid : [{ type: ObjectId, ref: 'Classinfo' }],
price: Number,
applydate: { type: Date, default: Date.now},
});
var Classinfo = new Schema({
classname: String,
createdate: { type: Date, default: Date.now }
});
我现在对Acount进行查找并populate
Account
.findOne({username: 'someone'})
.populate('applyform')
.exec(function (err, res) {
.....
})
结果res.applyform可以读到res.applyform.classid 但我想继续populate读到classname可以么?应该怎么继续populate?