xxxxxxxxxx
db.products.updateMany({}, {
$rename: { "foo": "bar" }
})
xxxxxxxxxx
// false,true is set for =>{upsert:false, multi:true}
db.foo.update({}, {$rename:{"name.additional":"name.last"}}, false, true);
xxxxxxxxxx
db.getCollection('posts').update({}, {$rename: { 'comments': 'texts'}} , {multi: true});
xxxxxxxxxx
use admin
db.runCommand({renameCollection: "[db_old_name].[collection_name]", to: "[db_new_name].[collection_name]"})