[英]How to find a subdocument of a collection and update it with Mongoose/MongoDB?
[英]MongoDB find and insert in a tree of subdocument (mongoose)
大家好我正在为我的应用程序创建类别树 。 可以创建的子类别的深度no limit (infinite)
。
有点像这样:
我的CategorySchema看起来像这样
schema: {
_id : String,
name: String,
children: [] // will contain subcats in form of {_id:String, name: String, children: []}
}
我的问题
我想要一个动态解决方案/ mongodb-query / mongoose-query 创建类别树。 我是mongodb的新手,我无法在网络上找到相关的问题解决方案,因此获得了帮助。
我已经花费了很多时间尝试。 请为我的问题提供任何(但应该是有效的)解决方案,以帮助我。
提前致谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.