Show
mongos> sh.shardCollection( "test.c" , {a: 1, b: 1})
{
"collectionsharded" : "test.c" ,
"collectionUUID" : UUID( "5c33de36-7f4a-4cc0-bdf1-b8101a7d34b1" ),
"ok" : 1,
"operationTime" : Timestamp(1573048485, 13),
"$clusterTime" : {
"clusterTime" : Timestamp(1573048485, 13),
"signature" : {
"hash" : BinData(0, "AAAAAAAAAAAAAAAAAAAAAAAAAAA=" ),
"keyId" : NumberLong(0)
}
}
}
mongos> use admin
mongos> sh.addShardToZone( "shard01" , "zone1" )
{
"ok" : 1,
"operationTime" : Timestamp(1573048597, 1),
"$clusterTime" : {
"clusterTime" : Timestamp(1573048597, 1),
"signature" : {
"hash" : BinData(0, "AAAAAAAAAAAAAAAAAAAAAAAAAAA=" ),
"keyId" : NumberLong(0)
}
}
}
mongos> db.runCommand({updateZoneKeyRange: "test.c" , min : {a: 1}, max: {a: 2}, zone: "zone1" })
{
"ok" : 1,
"operationTime" : Timestamp(1573048606, 8),
"$clusterTime" : {
"clusterTime" : Timestamp(1573048606, 8),
"signature" : {
"hash" : BinData(0, "AAAAAAAAAAAAAAAAAAAAAAAAAAA=" ),
"keyId" : NumberLong(0)
}
}
}
mongos> db.runCommand({updateZoneKeyRange: "test.c" , min : {a: 1}, max: {a: 2}, zone: null }) // Command succeeds but doesn't delete the tag range.
{
"ok" : 1,
"operationTime" : Timestamp(1573049199, 1),
"$clusterTime" : {
"clusterTime" : Timestamp(1573049199, 1),
"signature" : {
"hash" : BinData(0, "AAAAAAAAAAAAAAAAAAAAAAAAAAA=" ),
"keyId" : NumberLong(0)
}
}
}
mongos> db.getSiblingDB( "config" ).tags.find()
{ "_id" : ObjectId( "5dc2d11e8bc365c6f4466713" ), "ns" : "test.c" , "min" : { "a" : 1, "b" : { "$minKey" : 1 } }, "max" : { "a" : 2, "b" : { "$minKey" : 1 } }, "tag" : "zone1" }
mongos> db.runCommand({updateZoneKeyRange: "test.c" , min : {a: 1, b: MinKey}, max: {a: 2, b: MinKey}, zone: null }) // Deletes the tag range.
{
"ok" : 1,
"operationTime" : Timestamp(1573049663, 1),
"$clusterTime" : {
"clusterTime" : Timestamp(1573049663, 1),
"signature" : {
"hash" : BinData(0, "AAAAAAAAAAAAAAAAAAAAAAAAAAA=" ),
"keyId" : NumberLong(0)
}
}
}
mongos> db.getSiblingDB( "config" ).tags.find({min: {a: 1, b : MinKey}})
mongos>