Table of Contents

Method RenameCollection

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.Legacy.dll

RenameCollection(string, string)

Renames a collection on this database.

public virtual CommandResult RenameCollection(string oldCollectionName, string newCollectionName)

Parameters

oldCollectionName string

The old name for the collection.

newCollectionName string

The new name for the collection.

Returns

CommandResult

A CommandResult.

RenameCollection(string, string, bool)

Renames a collection on this database.

public virtual CommandResult RenameCollection(string oldCollectionName, string newCollectionName, bool dropTarget)

Parameters

oldCollectionName string

The old name for the collection.

newCollectionName string

The new name for the collection.

dropTarget bool

Whether to drop the target collection first if it already exists.

Returns

CommandResult

A CommandResult.