The db.collection.renameCollection() method operates within a collection by changing the metadata associated with a given collection. Refer to the ...
You can use renameCollection to rename an unsharded collection in a sharded cluster as long as the source and target databases are on the same primary shard.
Jan 4, 2012 · You can use the following syntax to rename an existing collection in MongoDB. db.originalCollectionName.renameCollection('newCollectionName').
db.collection.renameCollection() provides a helper for the renameCollection database command in the mongo shell to rename existing collections.
Aug 19, 2022 · The db.collection.renameCollection() method is used to rename a collection. Syntax: db.collection.renameCollection(target, dropTarget).
People also ask
Can I rename a collection in MongoDB Compass?
How to rename a MongoDB collection in Atlas?
How to change database in MongoDB?
How to update collection in MongoDB?
Apr 15, 2024 · 1. Using renameCollection(). The renameCollection() method in MongoDB is used to rename an existing collection within the same database.
MongoDatabase.RenameCollection Method (String, String) Renames a collection on this database. Namespace: MongoDB.Driver Assembly: MongoDB.Driver.Legacy
Changes the name of an existing collection. Specify collection names to renameCollection in the form of a complete namespace ( <database>.<collection> ).
I have a bit of functionality in my project where a mongoDb collection is being renamed. All was working OK until I have upgraded from 0.10.5 to version 0.11.5.
Changes the name of an existing collection. Specify collection names to renameCollection in the form of a complete namespace (<database>.<collection>).