PHP Класс Sokil\Mongo\Cursor

Наследование: implements Iterator, implements Countable
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__call ( $name, $arguments )
__construct ( Collection $collection, array $options = null )
asArray ( )
asObject ( )
byId ( string | MongoId $id ) : Cursor Filter by id
byIdList ( array $idList ) : Cursor Filter by list of \MongoId
copyToCollection ( type $targetCollectionName, type $targetDatabaseName = null ) Copy selected documents to another collection
count ( ) : integer Count documents in result without applying limit and offset
current ( )
explain ( )
expression ( ) : Expression Helper to create new expression
field ( string $field ) : Cursor Append field to accept list
fields ( array $fields ) : Cursor Return only specified fields
filter ( $handler )
findAll ( ) : array
findAndRemove ( ) : Document Get document instance and remove it from collection
findAndUpdate ( Operator $operator, boolean $upsert = false, boolean $returnUpdated = true ) : null | Document Find first document and update it
findOne ( ) : Document | array | null Find one document which correspond to expression
findRandom ( ) Get random document
getExpression ( ) : Expression Get query builder's expression
getHash ( ) Used to get hash that uniquely identifies current query
getIdList ( ) : array Gte list of \MongoId of current search query
getMongoQuery ( ) : array Get MongoDB query array
getOption ( string | integer $name, $default = null ) : mixed Get option
getReadPreference ( )
getResultSet ( ) : Sokil\Mongo\ResultSet Get result set of documents.
hint ( array | string $specification ) : Cursor Specify index to use
isDocumentPoolUsed ( )
isResultAsArray ( ) : boolean Check if result returned as array
key ( )
limit ( integer $limit, integer | null $offset = null ) : Cursor Limit result set to specified number of elements
limitedCount ( ) : integer Count documents in result with applying limit and offset
map ( $handler )
mixedToMongoIdList ( array $list ) : array Get list of MongoId objects from array of strings, MongoId's and Document's
moveToCollection ( type $targetCollectionName, type $targetDatabaseName = null ) Move selected documents to another collection.
next ( )
paginate ( integer $page, integer $itemsOnPage = 30 ) : Sokil\Mongo\Paginator Get paginator
pluck ( string $fieldName ) : array Return the values from a single field in the result set of documents
query ( Expression $expression ) : Cursor Merge expression
readNearest ( array $tags = null )
readPrimaryOnly ( )
readPrimaryPreferred ( array $tags = null )
readSecondaryOnly ( array $tags = null )
readSecondaryPreferred ( array $tags = null )
rewind ( )
setBatchSize ( integer $size ) : Cursor Specifies the number of documents to return in each batch of the response from the MongoDB instance.
setClientTimeout ( type $ms ) : Cursor Instructs the driver to stop waiting for a response and throw a MongoCursorTimeoutException after a set time, A timeout can be set at any time and will affect subsequent queries on the cursor, including fetching more results from the database.
setServerTimeout ( type $ms ) : Cursor Server-side timeout for a query, Specifies a cumulative time limit in milliseconds to be allowed by the server for processing operations on the cursor.
skip ( integer $skip ) : Cursor Skip defined number of documents
skipDocumentPool ( )
skipField ( string $field ) : Cursor Append field to skip list
skipFields ( array $fields ) : Cursor Return all fields except specified
slice ( string $field, integer $limit, integer $skip = null ) : Cursor Paginate list of sub-documents
sort ( array $sort ) : Cursor Sort result by specified keys and directions
useDocumentPool ( )
valid ( )

Приватные методы

Метод Описание
getCursor ( ) : MongoCursor
pluckDotNoteted ( string $fieldName ) : array Pluck by dot-notated field name

Описание методов

__call() публичный Метод

public __call ( $name, $arguments )

__construct() публичный Метод

public __construct ( Collection $collection, array $options = null )
$collection Collection
$options array

asArray() публичный Метод

public asArray ( )

asObject() публичный Метод

public asObject ( )

byId() публичный Метод

Filter by id
public byId ( string | MongoId $id ) : Cursor
$id string | MongoId id of document
Результат Cursor

byIdList() публичный Метод

Filter by list of \MongoId
public byIdList ( array $idList ) : Cursor
$idList array list of ids
Результат Cursor

copyToCollection() публичный Метод

Copy selected documents to another collection
public copyToCollection ( type $targetCollectionName, type $targetDatabaseName = null )
$targetCollectionName type
$targetDatabaseName type Target database name. If not specified - use current

count() публичный Метод

Count documents in result without applying limit and offset
public count ( ) : integer
Результат integer count

current() публичный Метод

public current ( )

explain() публичный Метод

public explain ( )

expression() публичный Метод

Helper to create new expression
public expression ( ) : Expression
Результат Expression

field() публичный Метод

Append field to accept list
public field ( string $field ) : Cursor
$field string field name
Результат Cursor

fields() публичный Метод

Return only specified fields
public fields ( array $fields ) : Cursor
$fields array
Результат Cursor

filter() публичный Метод

public filter ( $handler )

findAll() публичный Метод

public findAll ( ) : array
Результат array result of searching

findAndRemove() публичный Метод

Get document instance and remove it from collection
public findAndRemove ( ) : Document
Результат Document

findAndUpdate() публичный Метод

Find first document and update it
public findAndUpdate ( Operator $operator, boolean $upsert = false, boolean $returnUpdated = true ) : null | Document
$operator Operator operations with document to update
$upsert boolean if document not found - create
$returnUpdated boolean if true - return updated document
Результат null | Document

findOne() публичный Метод

Find one document which correspond to expression
public findOne ( ) : Document | array | null
Результат Document | array | null

findRandom() публичный Метод

Get random document
public findRandom ( )

getExpression() публичный Метод

Get query builder's expression
public getExpression ( ) : Expression
Результат Expression

getHash() публичный Метод

Used to get hash that uniquely identifies current query
public getHash ( )

getIdList() публичный Метод

Gte list of \MongoId of current search query
public getIdList ( ) : array
Результат array

getMongoQuery() публичный Метод

Get MongoDB query array
public getMongoQuery ( ) : array
Результат array

getOption() публичный Метод

Get option
public getOption ( string | integer $name, $default = null ) : mixed
$name string | integer
Результат mixed

getReadPreference() публичный Метод

public getReadPreference ( )

getResultSet() публичный Метод

Get result set of documents.
public getResultSet ( ) : Sokil\Mongo\ResultSet
Результат Sokil\Mongo\ResultSet

hint() публичный Метод

Specify index to use
public hint ( array | string $specification ) : Cursor
$specification array | string Specify the index either by the index name or by document
Результат Cursor

isDocumentPoolUsed() публичный Метод

public isDocumentPoolUsed ( )

isResultAsArray() публичный Метод

Check if result returned as array
public isResultAsArray ( ) : boolean
Результат boolean

key() публичный Метод

public key ( )

limit() публичный Метод

Limit result set to specified number of elements
public limit ( integer $limit, integer | null $offset = null ) : Cursor
$limit integer number of elements in result set
$offset integer | null number of elements to skip
Результат Cursor

limitedCount() публичный Метод

Count documents in result with applying limit and offset
public limitedCount ( ) : integer
Результат integer count

map() публичный Метод

public map ( $handler )

mixedToMongoIdList() публичный статический Метод

Get list of MongoId objects from array of strings, MongoId's and Document's
public static mixedToMongoIdList ( array $list ) : array
$list array
Результат array list of \MongoId

moveToCollection() публичный Метод

Dociuments will be removed from source collection only after copying them to target collection.
public moveToCollection ( type $targetCollectionName, type $targetDatabaseName = null )
$targetCollectionName type
$targetDatabaseName type Target database name. If not specified - use current

next() публичный Метод

public next ( )

paginate() публичный Метод

Get paginator
public paginate ( integer $page, integer $itemsOnPage = 30 ) : Sokil\Mongo\Paginator
$page integer page number
$itemsOnPage integer number of items on page
Результат Sokil\Mongo\Paginator

pluck() публичный Метод

Return the values from a single field in the result set of documents
public pluck ( string $fieldName ) : array
$fieldName string
Результат array

query() публичный Метод

Merge expression
public query ( Expression $expression ) : Cursor
$expression Expression
Результат Cursor

readNearest() публичный Метод

public readNearest ( array $tags = null )
$tags array

readPrimaryOnly() публичный Метод

public readPrimaryOnly ( )

readPrimaryPreferred() публичный Метод

public readPrimaryPreferred ( array $tags = null )
$tags array

readSecondaryOnly() публичный Метод

public readSecondaryOnly ( array $tags = null )
$tags array

readSecondaryPreferred() публичный Метод

public readSecondaryPreferred ( array $tags = null )
$tags array

rewind() публичный Метод

public rewind ( )

setBatchSize() публичный Метод

Specifies the number of documents to return in each batch of the response from the MongoDB instance.
public setBatchSize ( integer $size ) : Cursor
$size integer number of documents
Результат Cursor

setClientTimeout() публичный Метод

Instructs the driver to stop waiting for a response and throw a MongoCursorTimeoutException after a set time, A timeout can be set at any time and will affect subsequent queries on the cursor, including fetching more results from the database.
public setClientTimeout ( type $ms ) : Cursor
$ms type
Результат Cursor

setServerTimeout() публичный Метод

Server-side timeout for a query, Specifies a cumulative time limit in milliseconds to be allowed by the server for processing operations on the cursor.
public setServerTimeout ( type $ms ) : Cursor
$ms type
Результат Cursor

skip() публичный Метод

Skip defined number of documents
public skip ( integer $skip ) : Cursor
$skip integer number of documents to skip
Результат Cursor

skipDocumentPool() публичный Метод

public skipDocumentPool ( )

skipField() публичный Метод

Append field to skip list
public skipField ( string $field ) : Cursor
$field string field name
Результат Cursor

skipFields() публичный Метод

Return all fields except specified
public skipFields ( array $fields ) : Cursor
$fields array
Результат Cursor

slice() публичный Метод

Paginate list of sub-documents
public slice ( string $field, integer $limit, integer $skip = null ) : Cursor
$field string
$limit integer
$skip integer
Результат Cursor

sort() публичный Метод

An array of fields by which to sort. Each element in the array has as key the field name, and as value either 1 for ascending sort, or -1 for descending sort. Each result is first sorted on the first field in the array, then (if it exists) on the second field in the array, etc. This means that the order of the fields in the fields array is important. See also the examples section.
public sort ( array $sort ) : Cursor
$sort array
Результат Cursor

useDocumentPool() публичный Метод

public useDocumentPool ( )

valid() публичный Метод

public valid ( )