Property | Type | Description | |
---|---|---|---|
$db | the MongoDB connection object or the application component ID of the MongoDB connection that this migration should work with. Starting from version 2.0.2, this can also be a configuration array for creating the object. |
Method | Description | |
---|---|---|
batchInsert ( array | string $collection, array $rows, array $options = [] ) : array | Inserts several new rows into collection. | |
createCollection ( string | array $collection, array $options = [] ) | Creates new collection with the specified options. | |
createIndex ( string | array $collection, array | string $columns, array $options = [] ) | Creates an index on the collection and the specified fields. | |
createIndexes ( string | array $collection, array $indexes ) | Creates indexes in the collection. | |
dropAllIndexes ( string | array $collection ) | Drops all indexes for specified collection. | |
dropCollection ( string | array $collection ) | Drops existing collection. | |
dropIndex ( string | array $collection, string | array $columns ) | Drop indexes for specified column(s). | |
dropIndexes ( string | array $collection, string $indexes ) | Drops collection indexes by name. | |
init ( ) | Initializes the migration. | |
insert ( array | string $collection, array | object $data, array $options = [] ) : MongoDB\BSON\ObjectID | Inserts new data into collection. | |
remove ( array | string $collection, array $condition = [], array $options = [] ) : integer | boolean | Removes data from the collection. | |
save ( array | string $collection, array | object $data, array $options = [] ) : MongoDB\BSON\ObjectID | Update the existing database data, otherwise insert this data | |
update ( array | string $collection, array $condition, array $newData, array $options = [] ) : integer | boolean | Updates the rows, which matches given criteria by given data. |
Method | Description | |
---|---|---|
beginProfile ( string $token ) | Marks the beginning of a code block for profiling. | |
composeCollectionLogName ( array | string $collection ) : string | Composes string representing collection name. | |
endProfile ( string $token ) | Marks the end of a code block for profiling. | |
log ( string $string ) | Logs the incoming message. |
public batchInsert ( array | string $collection, array $rows, array $options = [] ) : array | ||
$collection | array | string | collection name. |
$rows | array | array of arrays or objects to be inserted. |
$options | array | list of options in format: optionName => optionValue. |
return | array | inserted data, each row will have "_id" key assigned to it. |
protected beginProfile ( string $token ) | ||
$token | string | token for the code block. |
public dropAllIndexes ( string | array $collection ) | ||
$collection | string | array | name of the collection. |
public dropCollection ( string | array $collection ) | ||
$collection | string | array | name of the collection |
protected endProfile ( string $token ) | ||
$token | string | token for the code block. |
public init ( ) |
public insert ( array | string $collection, array | object $data, array $options = [] ) : MongoDB\BSON\ObjectID | ||
$collection | array | string | collection name. |
$data | array | object | data to be inserted. |
$options | array | list of options in format: optionName => optionValue. |
return | MongoDB\BSON\ObjectID | new record id instance. |
public remove ( array | string $collection, array $condition = [], array $options = [] ) : integer | boolean | ||
$collection | array | string | collection name. |
$condition | array | description of records to remove. |
$options | array | list of options in format: optionName => optionValue. |
return | integer | boolean | number of updated documents or whether operation was successful. |
public save ( array | string $collection, array | object $data, array $options = [] ) : MongoDB\BSON\ObjectID | ||
$collection | array | string | collection name. |
$data | array | object | data to be updated/inserted. |
$options | array | list of options in format: optionName => optionValue. |
return | MongoDB\BSON\ObjectID | updated/new record id instance. |
public update ( array | string $collection, array $condition, array $newData, array $options = [] ) : integer | boolean | ||
$collection | array | string | collection name. |
$condition | array | description of the objects to update. |
$newData | array | the object with which to update the matching records. |
$options | array | list of options in format: optionName => optionValue. |
return | integer | boolean | number of updated documents or whether operation was successful. |