renameCollection

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


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

Rename the collection with oldCollectionName to the newCollectionName.

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