请问下这样的数据应该如何定义Schema,怎么用push操作List数组?
走同样的路,发现不同的人生
If the outermost List can be changed to an array, it can be defined in the following way
const childChildSchema = new mongoose.Schema({ PlayerID: Number, Msg: String, Time: Date }); const childSchema = new mongoose.Schema({ PlayerID: Number, ReadLast: Date, List:[childChildSchema] }); const parentSchema = new mongoose.Schema({ ID: Number, List: [childSchema] });
If the outermost List can be changed to an array, it can be defined in the following way