Eliminar colecciones en mongodb

Hey @edith_t ,

To update such collection name, one can try using below code in mongosh

var authColl = db.getCollection("Prueba uno");
authColl.renameCollection("prueba");

Alternate way to do the same via query

db[“Prueba uno”].renameCollection(“prueba”)

Note: Please test the code in your test environment and update the code as per your requirements before making any changes to production environment.

Tarun

2 Likes