added count() method to MongoModel
This commit is contained in:
@ -28,7 +28,14 @@ class MongoDriver extends NoSqlDbDriver
|
||||
|
||||
public function count($collection, $query = array(), $limit = 0, $skip = 0)
|
||||
{
|
||||
return $this->getCollection($collection)->count($query, $limit, $skip);
|
||||
$command = MongoCommandBuilder::factory(MongoCommandBuilder::COUNT, $this->getCollection($collection));
|
||||
$params = array(
|
||||
'condition' => $query,
|
||||
'limit' => $limit,
|
||||
'skip' => $skip
|
||||
);
|
||||
|
||||
return $this->query($command, $params)->affectedRows();
|
||||
}
|
||||
|
||||
public function find($collection, $condition = array(), $fields = array())
|
||||
|
Reference in New Issue
Block a user