- Dump the collection data, drop the collection, create a new collection and shard key, import the data.
- Add second shard key and drop the first shard key.
- Dump the collection data, drop the collection, presplit the data, create a new collection and shard key, import the data.
- Drop and recreate the shard key.
You need to change the shard key of an existing MongoDB collection. What do you do?
June 25, 2021June 25, 2021
0 Comment