'Renaming collection in MongoDB

I am trying to rename a collection in MongoDB. I accidently wrote

db.currentName.renameCollection()

but I should have wrote

db.currentName.renameCollection(newName)

Now when I try to rename the collection I get "source namespace does not exist, code 26". How can I rename it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source