0
모델에 대한 쿼리를 실행하고 싶지만 쿼리가 일치하는 경우에만 포함 된 문서를 반환하십시오. 다음을 고려하십시오 ...Mongoose의 모델에서 포함 된 문서 만 추출 할 수 있습니까?
var EventSchema = new mongoose.Schema({
typ : { type: String },
meta : { type: String }
});
var DaySchema = new mongoose.Schema({
uid: mongoose.Schema.ObjectId,
events: [EventSchema],
dateR: { type: Date, 'default': Date.now }
});
function getem() {
DayModel.find({events.typ : 'magic'}, function(err, days) {
// magic. ideally this would return a list of events rather then days
});
}
이 작업을 수행하면 DayModel 문서 목록이 반환됩니다. 하지만 내가 좋아할만한 것은 EventSchemas의 목록뿐입니다. 이것이 가능한가?