我有個 schema中 有如下一個變量:receiveComments:[{ whoComment:{ type:ObjectId, ref:'Student' }, whichHelp:{ type:ObjectId, ref:"Help" }, whichComment:{ type:ObjectId, ref:"Comment" } }],其中的 whichComment 是用population 引用的 Comment schema的,是不是不能修改 whichComment 中的數(shù)據(jù)。比如:Comment schema 中有一個變量如下:have_saw:{ type:Boolean, default:false
},現(xiàn)在我通過 whichComment 修改 have_saw 為true,然后保存,本地 mongodb 數(shù)據(jù)庫看不到對應(yīng)的數(shù)據(jù),但是下次輸出,這個值卻沒有改變,說明沒有保存成功,保存不了那個值?
mongoose 的 population 的問題?
ibeautiful
2018-10-01 13:18:56