You need to change the shard key of an existing MongoDB collection. What do you do?

  • 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.

Leave a Reply

Your email address will not be published. Required fields are marked *