Since: 1.6.0

interface CursorInterface implements Traversable (View source)

This interface is implemented by MongoDB\Driver\Cursor but may also be used for type-hinting and userland classes.

Methods

Int64
getId()

Returns the cursor ID associated with this cursor. A cursor ID uniquely identifies the cursor on the server.

getServer()

Returns the MongoDB\Driver\Server associated with this cursor.

bool
isDead()

Checks whether the cursor may have additional results available to read.

void
setTypeMap(array $typemap)

Sets a type map to use for BSON unserialization

array
toArray()

Iterates the cursor and returns its results in an array.

Details

Int64 getId()

Returns the cursor ID associated with this cursor. A cursor ID uniquely identifies the cursor on the server.

Return Value

Int64

Returns the cursor ID for this cursor.

Exceptions

InvalidArgumentException

Server getServer()

Returns the MongoDB\Driver\Server associated with this cursor.

This is the server that executed the MongoDB\Driver\Query or MongoDB\Driver\Command.

Return Value

Server

Returns the MongoDB\Driver\Server associated with this cursor.

Exceptions

InvalidArgumentException

bool isDead()

Checks whether the cursor may have additional results available to read.

Return Value

bool

Returns TRUE if additional results are not available, and FALSE otherwise.

Exceptions

InvalidArgumentException

void setTypeMap(array $typemap)

Sets a type map to use for BSON unserialization

Parameters

array $typemap

Type map configuration.

Return Value

void

Exceptions

InvalidArgumentException

array toArray()

Iterates the cursor and returns its results in an array.

MongoDB\Driver\CursorInterface::setTypeMap() may be used to control how documents are unserialized into PHP values.

Return Value

array

Returns an array containing all results for this cursor.

Exceptions

InvalidArgumentException