renameCollection

suspend fun renameCollection(newCollectionNamespace: MongoNamespace, options: RenameCollectionOptions = RenameCollectionOptions())

Rename the collection with oldCollectionName to the newCollectionName.

Parameters

newCollectionNamespace

the name the collection will be renamed to

options

the options for renaming a collection

See also

Throws

MongoServerException

if you provide a newCollectionName that is the name of an existing collection and dropTarget is false, or if the oldCollectionName is the name of a collection that doesn't exist


suspend fun renameCollection(clientSession: ClientSession, newCollectionNamespace: MongoNamespace, options: RenameCollectionOptions = RenameCollectionOptions())

Rename the collection with oldCollectionName to the newCollectionName.

Since

3.6

Parameters

clientSession

the client session with which to associate this operation

newCollectionNamespace

the name the collection will be renamed to

options

the options for renaming a collection

See also

Throws

MongoServerException

if you provide a newCollectionName that is the name of an existing collection and dropTarget is false, or if the oldCollectionName is the name of a collection that doesn't exist