我正在管道中使用$graphLookup创建View但失败了。有人有什么想法吗?$cmd:{"create":"employee.view.list","viewOn":"employee","pipeline":[{"$graphLookup":{"from":"employee.view.list","connectToField":"_id","startWith":"$supervisor","connectFromField":"supervisor","as":"supervisors","maxDepth":10}}]}错误Viewcycledetected:test_s
我试着运行一个$graphLookup类似于下面的打印演示:目标是,给定一个特定的记录(注释$match),通过immediateAncestors属性检索它的完整“路径”。如你所见,它没有发生。我在这里介绍了$convert来处理collection中的_id作为string,相信可以与_id记录列表中的immediateAncestors进行“匹配”(这是一个string)。所以,我用不同的数据进行了另一个测试(没有涉及到ObjectIds):db.nodos.insert({"id":5,"name":"cinco","children":[{"id":4}]})db.nodos
我正在尝试使用新的MongoDBv3.4$graphLookup聚合管道。我有这个简单的树集合,有一些节点和一个父DBRef:{"_id":ObjectId("59380657bbdbfb36c18a80f2"),"name":"Rootnode1"},{"_id":ObjectId("5938068abbdbfb36c18a80f5"),"name":"Child1.1","parent":ObjectId("59380657bbdbfb36c18a80f2")},{"_id":ObjectId("593806b0bbdbfb36c18a80f7"),"name":"Subchild
我有以下数据集:{_id:ObjectId("asdasdasd..."),dependencies:{customers:[ObjectId("1..."),ObjectId("2...")]}}我使用“$graphLookup”查看所有相互关联的客户。db.getCollection('customers').aggregate([{$graphLookup:{from:"customers",startWith:"$dependencies.customers",connectFromField:"dependencies.customers",connectToField:"_