Is there a dead easy way to rename a collection in mongo? Something like:
db.originalCollectionName.rename(\'newCollectionName\');
And if
You can use the following syntax to rename an existing collection in MongoDB.
db.originalCollectionName.renameCollection('newCollectionName')
For instance, if your existing collection name is 'demo' and want to rename to 'demo_updated' then, the query would be as follows:-
db.demo.renameCollection('demo_updated')
Thanks!