<分区>
我已经使用$push
来更新一个数组的元素。但是,当我尝试更新多个数组的元素时,$push
使用逗号分隔值,如下所示,它显示错误。它是怎么做到的?
var conditions = { some condition };
var update = { $push : {Feedback : { Feedbacks:req.body.Feedbacks}}, {Strength : { Strengths:req.body.Strengths}}};
var options = { multi : true};
Model.update(conditions, update, options, callback);
架构是:
Model : {
Field1 : {
type:Number
},
Field2: {
type : String
},
Feedback : {
type: Array,
Default:[]
},
Strength : {
type: Array,
Default: [],
}
};
注意:它适用于一个数组更新(如果我在推送后只保留反馈数组)但不适用于多个数组更新。多个数组怎么办?