Schema是这样的
var DepartmentSchema = new Schema({ name:String, major:[{ name:String }] });
然后我想匹配数组中存在某个值,比如major数组存在{name:"name"}的所有项于是这样。
DepartMentModel.findOne({major:{name:"name"}});
然而并没有匹配到。是不是我的匹配条件没写对啊
DepartMentModel.find({major.name: "name"});
DepartMentModel.find({major.name: "name"});