Documentation

RenameCollection
in package
implements Executable

Operation for the renameCollection command.

Tags
see
Collection::rename()
see
Database::renameCollection()
see
https://docs.mongodb.org/manual/reference/command/renameCollection/

Interfaces, Classes, Traits and Enums

Executable

Table of Contents

$fromNamespace  : string
$options  : array<string|int, mixed>
$toNamespace  : string
__construct()  : mixed
Constructs a renameCollection command.
execute()  : array<string|int, mixed>|object
Execute the operation.
createOptions()  : array<string|int, mixed>
Create options for executing the command.

Properties

Methods

__construct()

Constructs a renameCollection command.

public __construct(string $fromDatabaseName, string $fromCollectionName, string $toDatabaseName, string $toCollectionName[, array<string|int, mixed> $options = [] ]) : mixed

Supported options:

  • session (MongoDB\Driver\Session): Client session.

  • typeMap (array): Type map for BSON deserialization. This will be used for the returned command result document.

  • writeConcern (MongoDB\Driver\WriteConcern): Write concern.

  • dropTarget (boolean): If true, MongoDB will drop the target before renaming the collection.

Parameters
$fromDatabaseName : string

Database name

$fromCollectionName : string

Collection name

$toDatabaseName : string

New database name

$toCollectionName : string

New collection name

$options : array<string|int, mixed> = []

Command options

Tags
throws
InvalidArgumentException

for parameter/option parsing errors

Return values
mixed

execute()

Execute the operation.

public execute(Server $server) : array<string|int, mixed>|object
Parameters
$server : Server
Tags
see
Executable::execute()
throws
UnsupportedException

if write concern is used and unsupported

throws
DriverRuntimeException

for other driver errors (e.g. connection errors)

Return values
array<string|int, mixed>|object

Command result document

Search results