im试图获取所有匹配某个值但不起作用的匹配对象
这是我的生日:
我的model.js
var professorSchema = new schema({
nome : {type: String},
email : {type: String},
url : {type: String}
})
var aulaSchema = new schema ({
tipo : {type: String},
data : {type: String},
})
var sumarioSchema = new schema({
disciplina : {type: String},
professor : {professorSchema},
aula :[aulaSchema]
})
和我的controller.js
Sumarios.listAula = ()=>{
return Sumario.aggregate(
// Start with a $match pipeline which can take advantage of an index and limit documents processed
{ $match : {
"aula.tipo":"T"
}},
{ $unwind : "$aula" },
{ $match : {
"aula.tipo":"T"
}}
).exec()
}
我试图在控制器中执行的查询正在返回每个数据,而不是我想要的数据。我的模型有问题吗?