Parameter Type Description
string The new name of the collection. Enclose the string in quotes.
boolean Optional. If
mongoddrops the target of
renameCollectionprior to renaming the collection. The default value is
db.collection.renameCollection() method on a
collection object. For example:
This operation will rename the
rrecord collection to
the target name (i.e.
record) is the name of an existing collection,
then the operation will fail.
The method has the following limitations:
db.collection.renameCollection()cannot move a collection between databases. Use
renameCollectionfor these rename operations.
db.collection.renameCollection()is not supported on sharded collections.
db.collection.renameCollection() method operates within a
collection by changing the metadata associated with a given collection.
Refer to the documentation
renameCollection for additional
warnings and messages.
db.collection.renameCollection() method and
renameCollection command will invalidate open cursors
which interrupts queries that are currently returning data.