2016-09-08 184 views
1

我有以下模式配置:節約嵌套的貓鼬對象數組

childSchema = mongoose.Schema({ 
    filePath: String, 
    color: String 
}) 
parentSchema = mongoose.Schema({ 
    date: String, 
    files: [childSchema] 
}) 
grandparentSchema = mongoose.Schema({ 
    name: String, 
    byDate: [parentSchema] 
}) 

保存parentSchema的更新錄入工作正常使用

model.markModified('byDate') 
model.save() 

,但它不與childSchema工作。

我也嘗試過使用MongooseArray.set()方法,但沒有成功。

我在這裏做錯了什麼?

謝謝!

回答

0

Apperantly我的錯誤是不是在拯救,但在檢索:

改變data.byDate數據[0] .byDate我發現回調化險爲夷。

對不起提前詢問。這確實是一個微不足道的錯誤