0
몽구스를 사용하여 역동적 인 조건을 만들려고하고 있지만 상상하지 못합니다. 당신이, 내가 "인덱스"변수를 사용하여 동적 조건을 만들려고 노력하고있다시피몽구스로 다이나믹 한 쿼리하기
코드는이
id = req.params.questionId;
index = req.params.index;
callback = function(err,value){
if(err){
res.send(err)
}else{
res.send(value)
}
};
conditions = {
"_id": id,
"array._id": filterId
};
updates = {
$push: {
"array.$.array2."+index+".answeredBy": userId
}
};
options = {
upsert: true
};
Model.update(conditions, updates, options, callback);
같다. 이럴 수 있니?
미리 감사드립니다.
또는 Object.create를 사용하여 –
내 생명을 구했어. 고맙습니다! – masanorinyo