|
When a collection is created, it will be associated with a UUID. For a sharded collection, the UUID for this collection on all the shards should be the same. Otherwise, sharding related operations (e.g. chunk migration) will fail.
In the situation when a shard is down & lost all its data, when we try to re-create the collection on that shard, we would need to create the collection with the correct UUID. Currently it seems the only way to create a collection with the specified UUID is to run applyOps command (correct me if I have missed anything):
db.runCommand({applyOps:[{op:"c", ns:"DATABASE.$cmd", ui:UUID("COLLECTION_UUID"), o:{create:"COLLECTION"}}]})
|
It would be nice to have a shell helper/option for createCollection command to be able to create the collection with the specified UUID.
|