PHP Interface Mongolid\Cursor\CursorInterface

Inheritance: extends Iterato\Iterator
Show file Open project: leroy-merlin-br/mongolid

Public Methods

Method Description
all ( ) : array Convert the cursor instance to an array of Items.
count ( ) : integer Counts the number of results for this cursor.
first ( ) : mixed Returns the first element of the cursor.
limit ( integer $amount ) : Mongolid\Cursor\CursorInterface Limits the number of results returned.
skip ( integer $amount ) : Mongolid\Cursor\CursorInterface Skips a number of results.
sort ( array $fields ) : Mongolid\Cursor\CursorInterface Sorts the results by given fields.
toArray ( ) : array Return the raw cursor items.

Method Details

all() public method

Convert the cursor instance to an array of Items.
public all ( ) : array
return array

count() public method

Counts the number of results for this cursor.
public count ( ) : integer
return integer The number of documents returned by this cursor's query.

first() public method

Returns the first element of the cursor.
public first ( ) : mixed
return mixed

limit() public method

Limits the number of results returned.
public limit ( integer $amount ) : Mongolid\Cursor\CursorInterface
$amount integer The number of results to return.
return Mongolid\Cursor\CursorInterface Returns this cursor.

skip() public method

Skips a number of results.
public skip ( integer $amount ) : Mongolid\Cursor\CursorInterface
$amount integer The number of results to skip.
return Mongolid\Cursor\CursorInterface Returns this cursor.

sort() public method

Sorts the results by given fields.
public sort ( array $fields ) : Mongolid\Cursor\CursorInterface
$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.
return Mongolid\Cursor\CursorInterface Returns this cursor.

toArray() public method

Return the raw cursor items.
public toArray ( ) : array
return array