How to rename a mongodb collection

On installing a sample node.js application the associated mongo files ended up with long collection names including '.' and digit blocks.

To rename you cannot access the collection directly, as the dot-digit combination is illegal. Instead use

db.getCollection('mongodump.20130805.Customer').renameCollection('Customer');

to solve the problem.

Tags: mongodb