大家讲道理2017-04-18 10:54:04
You can retrieve the config collections. The collections in each document in the collections are sharded; you can also learn the specific situation of the sharding of the collection. 说着有点拗口
The following example is one of the collections given in the official documentation:
{
"_id" : "records.pets", --Database name.Collection name
"lastmod" : ISODate("1970-01-16T15:00:58.107Z"),
"dropped" : false,
"key" : {
"a" : 1 --Shard key
},
"unique" : false,
"lastmodEpoch" : ObjectId("5078407bd58b175c5c225fdc")
}
Use Java code to retrieve the above collection to get the required sharding information.
For reference.
Love MongoDB! Have Fun!