Any idea how to model a Tree document in Mongoose Schema?
var TreeSchema = new Schema({
"Non-leafNode": {
"children": [
{
"type": "NodeElement"
}
]
},
"NodeElement": {
// one of them is required. not both.
"elem": {
"type": "LeafNode"
},
"elem2": {
"type": "Non-leafNode"
}
},
"LeafNode": {}
});
How could one model this? The entire Tree is one document (ideally).
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…