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()方法,但没有成功。
我在这里做错了什么?
谢谢!