MongoDB Rename collection in Sharding MongoDB Rename collection in Sharding mongoose mongoose

MongoDB Rename collection in Sharding


There is no way to rename a sharded collection.

You can copy all the docs to a new collection.

Or create multiple collections based on a weekly/period date, and use as the current one. Then have your application always use the current one by name and change the name at each period break.


This is one of the worst limitations of MongoDB. we can not rename sharded collection. Mongodb Document says: db.collection.renameCollection() is not supported on sharded collections.

We had the same situation where we created another temporary collection, loaded data into that temporary collection. Dropped the existing sharded collection and created new collection with new name and then again loaded back data in newly named collection. This process was very