在Mongodb集群中查找文档的位置,

时间:2015-08-07 13:43:26

标签: mongodb sharding

我必须在Mongodb中存储一百万份文件。 Mongodb集群由4个分片,1个mongos和1个配置服务器组成。

如何获取文档的详细信息,如:

  1. 哪个分片包含文档?
  2. 哪个块包含文档?

1 个答案:

答案 0 :(得分:3)

嘿,找到您可以使用expalain()

的文档位置

查找文件位置的步骤

1. Open Mongos terminanl

2. Switch to your databse

3. find document of which you want to search location using explain()

eg db.collection.find({"x":1234}).explain()

您将获得json格式的结果,在其中查找分片键。更多详情请查看link

相关问题