1
我有以下更新查詢:
var where = 'answers.round_' + ans.round + '_' + ans.iteration
Game.findByIdAndUpdate(gameId, {
$addToSet: {
where: ans
}
}, function(err, model) {
if (err)
throw err
console.log('after game update with answer ' + JSON.stringify(model))
callback()
})
和數據庫結構如下:
"_id: ObjectId("5304bc1dcf36941e3adcd3fd"),
"answers" : {
"round_1_1" : [],
...
}
問題是俺們對象未被推入"round_1_1"
陣列(不是我檢查它不是null
)。回調中的模型是我想更新的模型,只是更新沒有發生。
我的問題是類似this的東西,它像點符號不工作(即使在控制檯上輸出answers.round_1_1
。
哇,我真的需要仰望實況更詳細的考慮! – Pio