added MongoStatement method to count results before skip/limit

This commit is contained in:
Anton Grebnev
2012-02-06 18:12:23 +04:00
parent 0140c3f4ad
commit e5e7fdb7e6
3 changed files with 61 additions and 0 deletions

View File

@ -16,6 +16,15 @@ class MongoStatement extends DbStatement
protected $insertId = false;
public function count()
{
if ($this->result instanceof MongoCursor) {
return $this->result->count();
} else {
throw new GeneralException('MongoStatement error. Impossible count result of opened cursor.');
}
}
public function order($sort = array())
{
if ($this->result instanceof MongoCursor) {