English 中文(简体)
服务器边板
原标题:server side set intersection in mongodb

在我正在处理的申请中,一项要求是进行大规模交叉,总价值为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合作,以有效实施一套数据。

无论如何,任何反馈都是宝贵的。

最佳回答

我认为,你不妨重新考虑你的计划。 如果在12个阵列中有1 000个目标点,每个阵列为12个目标国,甚至连计算BSON的间接费用,这对大型阵列可能具有重要意义*(可能还有8个目标国)。 在1.8中,我们把文件的最大尺寸从4MB提高到16MB,但即便如此,对于你想要储存的物品来说,也是不够的。

* 出于历史原因,我们储存了各阵列中每个元素的加固指数,如果你加固了;100个元素,但需要6或7位数,就增加了。

问题回答

暂无回答




相关问题
Access DB Ref MongoDB

Whats the best way to access/query a DB Ref: UPDATE: users: name, groupref : {$ref:"groups",$id:"ObjectId ..." } } groups: name, topic, country,...,.. Assumption is that user belongs to only one ...

MongoDB nested sets

What re the best practices to store nested sets (like trees of comments) in MongoDB? I mean, every comment can have a parent comment and children-comments (answers). Storing them like this: { ...

MongoMapper and migrations

I m building a Rails application using MongoDB as the back-end and MongoMapper as the ORM tool. Suppose in version 1, I define the following model: class SomeModel include MongoMapper::Document ...

MongoDB takes long for indexing

I have the following setup: Mac Pro with 2 GB of RAM (yes, not that much) MongoDB 1.1.3 64-bit 8 million entries in a single collection index for one field (integer) wanted Calling .ensureIndex(...) ...

Storing and accessing large amounts of data

My application creates pieces of data that, in xml, would look like this: <resource url="someurl"> <term> <name>somename</name> <frequency>somenumber</...

热门标签