我可以在MongoDB中搜索集合吗? [英] Can I search across collections in MongoDB?

查看:119
本文介绍了我可以在MongoDB中搜索集合吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将我的数据插入MongoDB并有240个这样的文件。不是将所有内容都插入到一个大集合中,而是考虑将文件作为集合插入。这是一个好主意,如果我做一个常见的索引列上的很多查询?

I am inserting my data into MongoDB and had 240 such files. Instead of inserting everything into one big collection, I was thinking of inserting the files as a collection by themselves. Is this a good idea if I do a lot of queries on a commonly indexed column?

如果是这样,如何发起查询以查询数据库中的所有集合?

If so, how can I initiate a query to query all the collections in my database?

推荐答案

我认为你正在寻找的答案真的在你的另一个问题:是否有任何多核使用NoSQL系统?

I think the answer you're looking for is really here on your other question: Is there any multicore exploiting NoSQL system?

无法在Mongo中查询所有集合。这样做不会有什么意义。 MongoDB的力量集中在将数据非规范化到集合中。在所有集合中提供查询的操作完全违背了战术非规范化的概念。

There is no way to query across all collections in Mongo. It wouldn't make a lot of sense to do so. MongoDB's strength is focused on tactically denormalizing data into collections. Providing operations to query across all collections run exactly counter to the concept of tactical denormalization.

理论上,你只能运行240个查询。但更实际的,你可能会最终分区你的数据,所以你只需要查询一些集合。在这一点上,你回到我上面提供的链接,这表明分割您的数据可能是这里的答案。

In theory, you could just run 240 queries. But more practically you'll probably end up "partitioning" your data so that you only need to query some of the collections. At this point you end up back at the link I provided above, which suggests that sharding your data is probably the answer here.

这篇关于我可以在MongoDB中搜索集合吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆