Property | Type | Description | |
---|---|---|---|
$_index | Every index definition must contain key 'keys' with list of fields and orders, and optional options from @link http://php.net/manual/en/mongocollection.createindex.php: Example: array( array( 'keys' => array('field1' => 1, 'field2' => -1), 'unique' => true ), ... ) | ||
$_queryExpressionClass | expression class. This class may be overloaded to define own query methods (whereUserAgeGreatedThan(), etc.) | ||
$mongoCollectionClassName | |||
$versioning | default value of versioning |
Method | Description | |
---|---|---|
__construct ( |
||
__get ( $name ) | ||
addDocumentToDocumentPool ( |
Store document to pool | |
addDocumentsToDocumentPool ( array $documents ) : |
Store documents to identity map | |
aggregate ( callable | array | |
Aggregate using pipeline | |
batchDelete ( callable | array | |
Delete documents by expression | |
batchInsert ( array $rows, $validate = true ) : |
Insert multiple documents defined as arrays | |
batchUpdate ( |
Update multiple documents | |
clearDocumentPool ( ) | ||
count ( ) : integer | Total count of documents in collection | |
createAggregator ( ) : |
Start aggregation | |
createBatchDelete ( integer | string $writeConcern = null, integer $timeout = null, boolean $ordered = null ) : Sokil\Mongo\BatchDelete | Creates batch delete operation handler | |
createBatchInsert ( integer | string $writeConcern = null, integer $timeout = null, boolean $ordered = null ) : Sokil\Mongo\BatchInsert | Creates batch insert operation handler | |
createBatchUpdate ( integer | string $writeConcern = null, integer $timeout = null, boolean $ordered = null ) : Sokil\Mongo\BatchUpdate | Creates batch update operation handler | |
createDocument ( array $data = null ) : |
Factory method to get not stored Document instance from array | |
createIndex ( array $key, array $options = [] ) : |
Create index | |
delete ( ) : |
Delete collection | |
deleteDocument ( |
||
deleteDocuments ( $expression = [] ) | ||
deleteIndex ( array $key ) : |
Delete index | |
disableDocumentPool ( ) : |
Stop storing found documents to pool | |
documentPoolCount ( ) : integer | Get number of documents in document pool | |
enableDocumentPool ( ) : |
Start storing found documents to pool | |
enableVersioning ( ) : |
Start versioning documents on modify | |
ensure2dIndex ( string $field ) : |
Create geo index 2dsphere | |
ensure2dSphereIndex ( string $field ) : |
Create geo index 2dsphere | |
ensureFulltextIndex ( array | string $field = '$**', array $weights = null, $defaultLanguage = Language::ENGLISH, $languageOverride = null ) : |
Create fulltext index | |
ensureIndex ( array $key, array $options = [] ) : |
Create index | |
ensureSparseIndex ( array $key ) : |
Create sparse index. | |
ensureTTLIndex ( array $key, integer $seconds ) : |
Create TTL index | |
ensureUniqueIndex ( array $key, boolean $dropDups = false ) : |
Create unique index | |
explainAggregate ( array | |
Explain aggregation | |
expression ( ) : |
Create new Expression instance to use in query builder or update operations | |
find ( $callable = null ) : |
Create document query builder | |
findAsArray ( $callable = null ) : |
Create document query builder | |
getDatabase ( ) : |
||
getDistinct ( string $selector, array | callable | |
Retrieve a list of distinct values for the given key across a collection. | |
getDocument ( string | MongoId $id, callable $callable = null ) : |
Get document by id If callable specified, document always loaded directly omitting document pool. | |
getDocumentByReference ( array $ref, boolean $useDocumentPool = true ) : |
Get Document instance by it's reference | |
getDocumentClassName ( array $documentData = null ) : string | Override to define class name of document by document data | |
getDocumentDirectly ( string | MongoId $id, callable $callable = null ) : |
Get document by id directly omitting cache Method may return document as array if cursor configured through Cursor::asArray() | |
getDocumentFromDocumentPool ( string | integer | MongoId $id ) : |
Get document from identity map by it's id | |
getDocuments ( array $idList, callable $callable = null ) : array | null | Get documents by list of id | |
getDocumentsFromDocumentPool ( array $ids = null ) | Get documents from pool if they stored | |
getIndexes ( ) : array | Get index info | |
getMongoCollection ( ) : MongoCollection | Get native collection instance of mongo driver | |
getName ( ) : string | Get name of collection | |
getOption ( string | integer $name ) : mixed | Get option | |
getOptions ( ) | ||
getReadPreference ( ) | ||
getWriteConcern ( ) : integer | string | Get currently active write concern on all requests to collection | |
hasDocument ( |
Check if document belongs to collection | |
hydrate ( array $data, $useDocumentPool = true ) : |
Factory method to get document object from array of stored document | |
initIndexes ( ) : |
Create indexes based on self::$_index metadata | |
insert ( array $document ) : |
Direct insert of array to MongoDB without creating document object and validation | |
insertMultiple ( $rows, $validate = true ) | ||
isDocumentInDocumentPool ( |
Check if document exists in identity map | |
isDocumentPoolEmpty ( ) : boolean | Check if documents are in pool | |
isDocumentPoolEnabled ( ) : boolean | Check if document pool enabled and requested documents store to it | |
isVersioningEnabled ( ) : boolean | Check if versioning enabled | |
operator ( ) : |
Create Operator instance to use in update operations | |
readNearest ( array $tags = null ) | ||
readPrimaryOnly ( ) | ||
readPrimaryPreferred ( array $tags = null ) | ||
readSecondaryOnly ( array $tags = null ) | ||
readSecondaryPreferred ( array $tags = null ) | ||
removeDocumentFromDocumentPool ( |
Remove document instance from identity map | |
setMajorityWriteConcern ( integer $timeout = 10000 ) : |
Define majority write concern for all requests to current collection | |
setUnacknowledgedWriteConcern ( integer $timeout = 10000 ) : |
Define unacknowledged write concern for all requests to current collection | |
setWriteConcern ( string | integer $w, integer $timeout = 10000 ) : |
Define write concern for all requests to current collection | |
stats ( ) : array | Get collection stat | |
update ( |
Update multiple documents | |
updateAll ( |
Update all documents | |
updateMultiple ( $expression, $updateData ) | ||
validate ( boolean $full = false ) : array | Validates a collection. The method scans a collection’s data structures for correctness and returns a single document that describes the relationship between the logical collection and the physical representation of the data. |
public __construct ( |
||
$database | ||
$definition |
public addDocumentToDocumentPool ( |
||
$document | ||
return |
public addDocumentsToDocumentPool ( array $documents ) : |
||
$documents | array | list of Document instances |
return |
public batchDelete ( callable | array | |
||
$expression | callable | array | |
|
return |
public batchInsert ( array $rows, $validate = true ) : |
||
$rows | array | list of documents to insert, defined as arrays |
return |
public batchUpdate ( |
||
$expression | expression to define which documents will change. | |
$updateData | new data or operators to update | |
return |
public createAggregator ( ) : |
||
return |
public createBatchDelete ( integer | string $writeConcern = null, integer $timeout = null, boolean $ordered = null ) : Sokil\Mongo\BatchDelete | ||
$writeConcern | integer | string | Write concern. Default is 1 (Acknowledged) |
$timeout | integer | Timeout for write concern. Default is 10000 milliseconds |
$ordered | boolean | Determins if MongoDB must apply this batch in order (sequentally, one item at a time) or can rearrange it. Defaults to TRUE |
return | Sokil\Mongo\BatchDelete |
public createBatchInsert ( integer | string $writeConcern = null, integer $timeout = null, boolean $ordered = null ) : Sokil\Mongo\BatchInsert | ||
$writeConcern | integer | string | Write concern. Default is 1 (Acknowledged) |
$timeout | integer | Timeout for write concern. Default is 10000 milliseconds |
$ordered | boolean | Determins if MongoDB must apply this batch in order (sequentally, one item at a time) or can rearrange it. Defaults to TRUE |
return | Sokil\Mongo\BatchInsert |
public createBatchUpdate ( integer | string $writeConcern = null, integer $timeout = null, boolean $ordered = null ) : Sokil\Mongo\BatchUpdate | ||
$writeConcern | integer | string | Write concern. Default is 1 (Acknowledged) |
$timeout | integer | Timeout for write concern. Default is 10000 milliseconds |
$ordered | boolean | Determins if MongoDB must apply this batch in order (sequentally, one item at a time) or can rearrange it. Defaults to TRUE |
return | Sokil\Mongo\BatchUpdate |
public createDocument ( array $data = null ) : |
||
$data | array | |
return |
public createIndex ( array $key, array $options = [] ) : |
||
$key | array | |
$options | array | see @link http://php.net/manual/en/mongocollection.ensureindex.php |
return |
public deleteDocument ( |
||
$document | ||
return |
public deleteIndex ( array $key ) : |
||
$key | array | |
return |
public disableDocumentPool ( ) : |
||
return |
public documentPoolCount ( ) : integer | ||
return | integer |
public enableDocumentPool ( ) : |
||
return |
public enableVersioning ( ) : |
||
return |
public ensure2dIndex ( string $field ) : |
||
$field | string | |
return |
public ensure2dSphereIndex ( string $field ) : |
||
$field | string | |
return |
public ensureFulltextIndex ( array | string $field = '$**', array $weights = null, $defaultLanguage = Language::ENGLISH, $languageOverride = null ) : |
||
$field | array | string | definition of fields where full text index ensured. May be string to ensure index on one field, array of fields to create full text index on few fields, and widdcard '$**' to create index on all fields of collection. Default value is '$**' |
$weights | array | For a text index, the weight of an indexed field denotes the significance of the field relative to the other indexed fields in terms of the text search score. |
$defaultLanguage | The default language associated with the indexed data determines the rules to parse word roots (i.e. stemming) and ignore stop words. The default language for the indexed data is english. | |
$languageOverride | To use a field with a name other than language, include the language_override option when creating the index. | |
return |
public ensureIndex ( array $key, array $options = [] ) : |
||
$key | array | |
$options | array | see @link http://php.net/manual/en/mongocollection.ensureindex.php |
return |
public ensureSparseIndex ( array $key ) : |
||
$key | array | An array specifying the index's fields as its keys. For each field, the value is either the index direction or index type. If specifying direction, specify 1 for ascending or -1 for descending. |
return |
public ensureTTLIndex ( array $key, integer $seconds ) : |
||
$key | array | key must be date to use TTL |
$seconds | integer | |
return |
public ensureUniqueIndex ( array $key, boolean $dropDups = false ) : |
||
$key | array | |
$dropDups | boolean | |
return |
public explainAggregate ( array | |
||
$pipeline | array | |
|
return | array | result |
public expression ( ) : |
||
return |
public find ( $callable = null ) : |
||
$callable | callable|null Function to configure query builder& | |
return |
public findAsArray ( $callable = null ) : |
||
return |
public getDocumentClassName ( array $documentData = null ) : string | ||
$documentData | array | |
return | string | Document class data |
public getDocumentFromDocumentPool ( string | integer | MongoId $id ) : |
||
$id | string | integer | MongoId | |
return |
public getDocumentsFromDocumentPool ( array $ids = null ) | ||
$ids | array |
public getMongoCollection ( ) : MongoCollection | ||
return | MongoCollection |
public getWriteConcern ( ) : integer | string | ||
return | integer | string | write concern |
public hasDocument ( |
||
$document | ||
return | type |
public initIndexes ( ) : |
||
return |
public isDocumentPoolEmpty ( ) : boolean | ||
return | boolean |
public isDocumentPoolEnabled ( ) : boolean | ||
return | boolean |
public isVersioningEnabled ( ) : boolean | ||
return | boolean |
public operator ( ) : |
||
return |
public readSecondaryPreferred ( array $tags = null ) | ||
$tags | array |
public removeDocumentFromDocumentPool ( |
||
$document | ||
return |
public setMajorityWriteConcern ( integer $timeout = 10000 ) : |
||
$timeout | integer | timeout in milliseconds |
return |
public setUnacknowledgedWriteConcern ( integer $timeout = 10000 ) : |
||
$timeout | integer | timeout in milliseconds |
return |
public update ( |
||
$expression | expression to define which documents will change. | |
$updateData | new data or operators to update | |
$options | array | update options, see http://php.net/manual/ru/mongocollection.update.php |
return |
protected $_index |
protected $_queryExpressionClass |