PHP Class Phalcon\Db\Adapter\MongoDB\Operation\CreateIndexes

See also: MongoDB\Collection::createIndex()
See also: MongoDB\Collection::createIndexes()
See also: http://docs.mongodb.org/manual/reference/command/createIndexes/
Inheritance: implements Phalcon\Db\Adapter\MongoDB\Operation\Executable
Show file Open project: phalcon/incubator Class Usage Examples

Public Methods

Method Description
__construct ( string $databaseName, string $collectionName, array $indexes ) Constructs a createIndexes command.
execute ( MongoDB\Driver\Server $server ) : string[] Execute the operation.

Private Methods

Method Description
executeCommand ( MongoDB\Driver\Server $server ) Create one or more indexes for the collection using the createIndexes command.
executeLegacy ( MongoDB\Driver\Server $server ) Create one or more indexes for the collection by inserting into the "system.indexes" collection (MongoDB <2.6).

Method Details

__construct() public method

Constructs a createIndexes command.
public __construct ( string $databaseName, string $collectionName, array $indexes )
$databaseName string Database name
$collectionName string Collection name
$indexes array List of index specifications

execute() public method

For servers < 2.6, this will actually perform an insert operation on the database's "system.indexes" collection.
See also: Executable::execute()
public execute ( MongoDB\Driver\Server $server ) : string[]
$server MongoDB\Driver\Server
return string[] The names of the created indexes