我有一个架构
var card = new Schema({
id: Schema.Types.ObjectId,
tenthe: String,
mota: String,
nhan: String,
thanhvien: [Schema.Types.ObjectId],
ngayKT: Date,
checklist: [{
seq: Number,
tieude: String,
list: [{
noidung: String,
trangthai: Number,
seq: Number
}]
}],
dinhkem: [String],
binhluan: [{
hoten: String,
noidung: String,
thoigian: Date,
user: Schema.Types.ObjectId,
seq: Number
}],
seq: Number
})
我要更新trangthai字段
card.update({ 'checklist.list.seq': req.body.seql }, { $set: { "checklist.$.list": [{'trangthai': 1}], 'checklist.$.tieude': "aba" } }, (err, suc) => {
console.log(err);
console.log(suc);
res.json(suc);
})