Changing the name of a collection in mongodb can be achieved by copy the documents in the collection to a new one and delete the original.
But is there a simpler way to change the name of a collection in mongodb?
db.oldname.renameCollection("newname")
Really? No google search?
http://www.mongodb.org/display/DOCS/renameCollection+Command
> db.oldname.renameCollection("newname")
db.oldCollectionName.renameCollection("NewCollectionName")
Check Manual here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With