在 Mongodb 簇中查找文档的位置,
Find location of document in Mongodb cluster,
我不得不将一百万个文档存储到 Mongodb。 Mongodb 集群由 4 个分片、1 个 mongos 和 1 个配置服务器组成。
如何获取文档的详细信息,例如:
- 哪个分片包含文档?
- 哪个块包含文档?
嘿,找到您可以使用的文档位置 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 格式的结果,在其中查找 shards 键。更多详情请查看 link
我不得不将一百万个文档存储到 Mongodb。 Mongodb 集群由 4 个分片、1 个 mongos 和 1 个配置服务器组成。
如何获取文档的详细信息,例如:
- 哪个分片包含文档?
- 哪个块包含文档?
嘿,找到您可以使用的文档位置 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 格式的结果,在其中查找 shards 键。更多详情请查看 link