在我正在处理的申请中,一项要求是进行大规模交叉,总价值为10-1 000 000件。 我们相互交织的项目只是反对的。
例如,有箱子文件,盒子文件内有一件“ids Array”。 此项目:每个箱子的批量为10-1 000 000 000 000美元 反对:
这里的最终目标是,在方框A中,注明目标4d3dc3898951498107000005, 和标的B, 标注4d3dc3898951498107000002, 哪一个项目是它们的共同点?
这里是怎样做的:
db.boxes.distinct("item_ids", { _id : {$in : [ObjectId("4d3dc3898951498107000005"), ObjectId("4d3dc3898951498107000002")]}})
首先,如果这似乎是一种轻松的做法,那就是一种奇怪的做法。 在我迄今为止的研究中,似乎像地图减少一样,是大交叉点的共同建议,但建议不提出实时查询。
第二,在艰难的环境中如何做到这一点? 莫戈斯是否会在ongo子上 run子,看看看它需要什么,并 aggregate合我的成果?
最后,如果以上所述是轻松的,也应当做到:
db.items.find({ _id : { $in : db.eval(function() {return db.boxes.distinct("item_ids", {_id:{$in:[ObjectId("4d3dc3898951498107000005"), ObjectId("4d3dc3898951498107000002")]}}); }) }})
基本上将发现哪些箱子A和箱子B都有共同之处,然后将其输入一个服务器边的物体。 这似乎也与.limit和.skip合作,以有效实施一套数据。
无论如何,任何反馈都是宝贵的。