0
我有一个关于如何在MongoDB中设计祖先树的问题。有祖先阵列的MongoDB树设计
例如,如果我们有这样的:
{ "_id" : "ACL", "ancestors" : [ ], "parent" : null }
{ "_id" : "apps", "ancestors" : [ "ACL" ], "parent" : "ACL" }
{ "_id" : "3222", "ancestors" : [ "ACL", "apps" ], "parent" : "apps" }
{ "_id" : "1223", "ancestors" : [ "ACL", "apps" ], "parent" : "apps" }
这意味着我们有这样
ACL
|
Apps
/ \
3222 1223
我想有“用户”的节点每个节点下的树。但是,由于_id必须是唯一的,所以我不能这么做。
ACL
|
Apps
/ \
3222 1223
/ \
users users
你将如何去解决这个问题?
编辑:我已经在这里阅读MongoDB的模型树信息: http://docs.mongodb.org/manual/tutorial/model-tree-structures/