Mongo
PHP Manual

The MongoCursor class

소개

Result object for database query.

The database is not actually queried until next() or hasNext() is called. Before the database is queried, commands can be strung together, as in:

<?php
$cursor = $collection->find()->limit(10);

// database has not yet been queried, so more search options can be added
$cursor = $cursor->sort(array("a" => 1));

var_dump($cursor->getNext());
// now database has been queried and more options cannot be added

// so this will throw an exception:
$cursor->skip(4);
?>

클래스 개요

MongoCursor
implements Iterator {
/* Methods */
__construct ( resource $connection , string $ns [, array $query= array() [, array $fields= array() ]] )
public int count ( void )
public array current ( void )
protected void doQuery ( void )
public array explain ( void )
public array getNext ( void )
public boolean hasNext ( void )
public MongoCursor hint ( array $key_pattern )
public string key ( void )
public MongoCursor limit ( int $num )
public void next ( void )
public void reset ( void )
public void rewind ( void )
public MongoCursor skip ( int $num )
public MongoCursor sort ( array $fields )
public boolean valid ( void )
}

Table of Contents


Mongo
PHP Manual