class CommandCursor implements Iterator (View source)

Wrapper for the PHP MongoCommandCursor class.

Methods

__construct(MongoCommandCursor $mongoCommandCursor, integer $numRetries = 0)

Constructor.

$this
batchSize(integer $num)

Wrapper method for MongoCommandCursor::batchSize().

integer
count()

Recreates the command cursor and counts its results.

array|null
current()

Wrapper method for MongoCommandCursor::current().

boolean
dead()

Wrapper method for MongoCommandCursor::dead().

MongoCommandCursor
getMongoCommandCursor()

Returns the MongoCommandCursor instance being wrapped.

array|object|null
getSingleResult()

Rewind the cursor and return its first result.

array
info()

Wrapper method for MongoCommandCursor::info().

integer
key()

Wrapper method for MongoCommandCursor::key().

next()

Wrapper method for MongoCommandCursor::next().

array
rewind()

Wrapper method for MongoCommandCursor::rewind().

$this
timeout(integer $ms)

Wrapper method for MongoCommandCursor::timeout().

array
toArray()

Return the cursor's results as an array.

boolean
valid()

Wrapper method for MongoCommandCursor::valid().

mixed
retry(Closure $retry)

Conditionally retry a closure if it yields an exception.

Details

__construct(MongoCommandCursor $mongoCommandCursor, integer $numRetries = 0)

Constructor.

Parameters

MongoCommandCursor $mongoCommandCursor MongoCommandCursor instance being wrapped
integer $numRetries Number of times to retry queries

$this batchSize(integer $num)

Wrapper method for MongoCommandCursor::batchSize().

Parameters

integer $num

Return Value

$this

See also

http://php.net/manual/en/mongocommandcursor.batchsize.php

integer count()

Recreates the command cursor and counts its results.

Return Value

integer

See also

http://php.net/manual/en/countable.count.php

array|null current()

Wrapper method for MongoCommandCursor::current().

boolean dead()

Wrapper method for MongoCommandCursor::dead().

MongoCommandCursor getMongoCommandCursor()

Returns the MongoCommandCursor instance being wrapped.

Return Value

MongoCommandCursor

array|object|null getSingleResult()

Rewind the cursor and return its first result.

Return Value

array|object|null

See also

Iterator::getSingleResult

array info()

Wrapper method for MongoCommandCursor::info().

integer key()

Wrapper method for MongoCommandCursor::key().

next()

array rewind()

Wrapper method for MongoCommandCursor::rewind().

$this timeout(integer $ms)

Wrapper method for MongoCommandCursor::timeout().

Parameters

integer $ms

Return Value

$this

Exceptions

BadMethodCallException if MongoCommandCursor::timeout() is not available

See also

http://php.net/manual/en/mongocommandcursor.timeout.php

array toArray()

Return the cursor's results as an array.

Return Value

array

See also

Iterator::toArray

boolean valid()

Wrapper method for MongoCommandCursor::valid().

protected mixed retry(Closure $retry)

Conditionally retry a closure if it yields an exception.

If the closure does not return successfully within the configured number of retries, its first exception will be thrown.

Parameters

Closure $retry

Return Value

mixed