问题
var SomeSchema = new Schema({
createdAt: {
type: Date
},
updatedAt: {
type: Date
},
title: {
type: String,
required: true
},
items: [{
title: {
type: String
},
children: {}
}]
}, {collection : 'SomeCollection'});
The children object is essentially another array of item objects, which can further have nested children. So this is for a menu system with inifnite nesting of the same Schema. How do I define it?
来源:https://stackoverflow.com/questions/27268091/how-can-i-have-infinitely-nested-schemas-in-mongoose