downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

MongoCursor::__construct> <MongoCollection::validate
Last updated: Fri, 24 Jul 2009

view this page in

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



add a note add a note User Contributed Notes
MongoCursor
There are no user contributed notes for this page.

MongoCursor::__construct> <MongoCollection::validate
Last updated: Fri, 24 Jul 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites