Changing shard keys is fundamentally very expensive, but a helper to do this would be useful. The main thing needed would be to do the operation with good parallelism.
first cut might require the source collection be read only during the operation.
might do something like
- measure what the new distribution would be like by looking at a sampled set of records from the originating collection
- presplit based on statistics above
- cluster wide copy of data from src to dest collection
- build the index(es) for dest after the copy to make things as fast as possible
i suppose this is just a better version of cloneCollection which we'll want anyway.