我有一个具有三个深度级别的数据模型。
var job = mongoose.Schema({
id:Number,
jobName:String
});
var demo = mongoose.Schema({
id:Number,
demoName:String,
job:[job]
});
var ExerciseSchema = mongoose.Schema({
id:Number,
name:String,
area:String,
medicalObj:[demo]
});
var 练习 = mongoose.model('Exercise',ExerciseSchema);
我想将新对象推送到第二个嵌套数组中
我正在尝试这种方式但不工作:
Exercise.update({'area':area},{$push:{"medicalObj.job":{jobName:'Andrea'}}},{upsert:true},function(err){
if(err){
console.log("ERROR" + err);
}else{
console.log("Successfully");
}
});