PHP 클래스 MongoCursor

상속: implements Iterator
파일 보기 프로젝트 열기: alcaeus/mongo-php-adapter 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$slaveOkay boolean
$timeout integer

보호된 프로퍼티들

프로퍼티 타입 설명
$allowPartialResults
$awaitData
$flags
$hint
$limit
$maxTimeMS
$noCursorTimeout
$optionNames array
$options
$projection array
$query array
$skip
$snapshot
$sort
$tailable

공개 메소드들

메소드 설명
__construct ( MongoClient $connection, string $ns, array $query = [], array $fields = [] ) Create a new cursor
__sleep ( ) : array
addOption ( string $key, mixed $value ) : MongoCursor Adds a top-level key/value pair to a query
awaitData ( boolean $wait = true ) : MongoCursor (PECL mongo >= 1.2.11)
Sets whether this cursor will wait for a while for a tailable cursor to return more data
count ( boolean $foundOnly = false ) : integer Counts the number of results for this query
explain ( ) : array Return an explanation of the query, often useful for optimization and debugging
fields ( array $f ) : MongoCursor Sets the fields for a query
getNext ( ) : array Advances the cursor to the next result, and returns that result
hasNext ( ) : boolean Checks if there are any more elements in this cursor
hint ( array | string $keyPattern ) : MongoCursor Gives the database a hint about the query
immortal ( boolean $liveForever = true ) : MongoCursor Sets whether this cursor will timeout
limit ( integer $num ) : MongoCursor Limits the number of results returned
maxTimeMS ( integer $ms )
partial ( boolean $okay = true ) : MongoCursor
reset ( ) : void Clears the cursor
setFlag ( integer $flag, boolean $set = true ) : MongoCursor
skip ( integer $num ) : MongoCursor Skips a number of results
slaveOkay ( boolean $okay = true ) : MongoCursor Sets whether this query can be done on a slave This method will override the static class variable slaveOkay.
snapshot ( ) : MongoCursor Use snapshot mode for the query
sort ( array $fields ) : MongoCursor Sorts the results by given fields
tailable ( boolean $tail = true ) : MongoCursor Sets whether this cursor will be left open after fetching the last results

보호된 메소드들

메소드 설명
convertCursorType ( ) : integer | null
convertModifiers ( ) : array
convertProjection ( ) : array
doQuery ( ) : void Execute the query
ensureCursor ( ) : MongoDB\Driver\Cursor
getCursorInfo ( ) : array
wrapTraversable ( Traversable $traversable ) : Generator

메소드 상세

__construct() 공개 메소드

Create a new cursor
public __construct ( MongoClient $connection, string $ns, array $query = [], array $fields = [] )
$connection MongoClient Database connection.
$ns string Full name of database and collection.
$query array Database query.
$fields array Fields to return.

__sleep() 공개 메소드

public __sleep ( ) : array
리턴 array

addOption() 공개 메소드

Adds a top-level key/value pair to a query
public addOption ( string $key, mixed $value ) : MongoCursor
$key string Fieldname to add.
$value mixed Value to add.
리턴 MongoCursor Returns this cursor

awaitData() 공개 메소드

(PECL mongo >= 1.2.11)
Sets whether this cursor will wait for a while for a tailable cursor to return more data
public awaitData ( boolean $wait = true ) : MongoCursor
$wait boolean [optional]

If the cursor should wait for more data to become available.

리턴 MongoCursor Returns this cursor.

convertCursorType() 보호된 메소드

protected convertCursorType ( ) : integer | null
리턴 integer | null

convertModifiers() 보호된 메소드

protected convertModifiers ( ) : array
리턴 array

convertProjection() 보호된 메소드

protected convertProjection ( ) : array
리턴 array

count() 공개 메소드

Counts the number of results for this query
public count ( boolean $foundOnly = false ) : integer
$foundOnly boolean Send cursor limit and skip information to the count function, if applicable.
리턴 integer The number of documents returned by this cursor's query.

doQuery() 보호된 메소드

Execute the query
protected doQuery ( ) : void
리턴 void

ensureCursor() 보호된 메소드

protected ensureCursor ( ) : MongoDB\Driver\Cursor
리턴 MongoDB\Driver\Cursor

explain() 공개 메소드

Return an explanation of the query, often useful for optimization and debugging
public explain ( ) : array
리턴 array Returns an explanation of the query.

fields() 공개 메소드

Sets the fields for a query
public fields ( array $f ) : MongoCursor
$f array Fields to return (or not return).
리턴 MongoCursor

getCursorInfo() 보호된 메소드

protected getCursorInfo ( ) : array
리턴 array

getNext() 공개 메소드

Advances the cursor to the next result, and returns that result
public getNext ( ) : array
리턴 array Returns the next object

hasNext() 공개 메소드

Checks if there are any more elements in this cursor
public hasNext ( ) : boolean
리턴 boolean Returns true if there is another element

hint() 공개 메소드

Gives the database a hint about the query
public hint ( array | string $keyPattern ) : MongoCursor
$keyPattern array | string Indexes to use for the query.
리턴 MongoCursor Returns this cursor

immortal() 공개 메소드

Sets whether this cursor will timeout
public immortal ( boolean $liveForever = true ) : MongoCursor
$liveForever boolean If the cursor should be immortal.
리턴 MongoCursor Returns this cursor

limit() 공개 메소드

Limits the number of results returned
public limit ( integer $num ) : MongoCursor
$num integer The number of results to return.
리턴 MongoCursor Returns this cursor

maxTimeMS() 공개 메소드

public maxTimeMS ( integer $ms )
$ms integer

partial() 공개 메소드

public partial ( boolean $okay = true ) : MongoCursor
$okay boolean [optional]

If receiving partial results is okay.

리턴 MongoCursor Returns this cursor.

reset() 공개 메소드

Clears the cursor
public reset ( ) : void
리턴 void

setFlag() 공개 메소드

public setFlag ( integer $flag, boolean $set = true ) : MongoCursor
$flag integer
$set boolean
리턴 MongoCursor

skip() 공개 메소드

Skips a number of results
public skip ( integer $num ) : MongoCursor
$num integer The number of results to skip.
리턴 MongoCursor Returns this cursor

slaveOkay() 공개 메소드

Sets whether this query can be done on a slave This method will override the static class variable slaveOkay.
public slaveOkay ( boolean $okay = true ) : MongoCursor
$okay boolean If it is okay to query the slave.
리턴 MongoCursor Returns this cursor

snapshot() 공개 메소드

Use snapshot mode for the query
public snapshot ( ) : MongoCursor
리턴 MongoCursor Returns this cursor

sort() 공개 메소드

Sorts the results by given fields
public sort ( array $fields ) : MongoCursor
$fields array 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
리턴 MongoCursor Returns the same cursor that this method was called on

tailable() 공개 메소드

Sets whether this cursor will be left open after fetching the last results
public tailable ( boolean $tail = true ) : MongoCursor
$tail boolean If the cursor should be tailable.
리턴 MongoCursor Returns this cursor

wrapTraversable() 보호된 메소드

protected wrapTraversable ( Traversable $traversable ) : Generator
$traversable Traversable
리턴 Generator

프로퍼티 상세

$allowPartialResults 보호되어 있는 프로퍼티

protected $allowPartialResults

$awaitData 보호되어 있는 프로퍼티

protected $awaitData

$flags 보호되어 있는 프로퍼티

protected $flags

$hint 보호되어 있는 프로퍼티

protected $hint

$limit 보호되어 있는 프로퍼티

protected $limit

$maxTimeMS 보호되어 있는 프로퍼티

protected $maxTimeMS

$noCursorTimeout 보호되어 있는 프로퍼티

protected $noCursorTimeout

$optionNames 보호되어 있는 프로퍼티

protected array $optionNames
리턴 array

$options 보호되어 있는 프로퍼티

protected $options

$projection 보호되어 있는 프로퍼티

protected array $projection
리턴 array

$query 보호되어 있는 프로퍼티

protected array $query
리턴 array

$skip 보호되어 있는 프로퍼티

protected $skip

$slaveOkay 공개적으로 정적으로 프로퍼티

public static bool $slaveOkay
리턴 boolean

$snapshot 보호되어 있는 프로퍼티

protected $snapshot

$sort 보호되어 있는 프로퍼티

protected $sort

$tailable 보호되어 있는 프로퍼티

protected $tailable

$timeout 공개적으로 정적으로 프로퍼티

public static int $timeout
리턴 integer