Skip to content

Commit

Permalink
Merge pull request #1 from andrespera/feature/count-with-query
Browse files Browse the repository at this point in the history
Count collection with a specific query
  • Loading branch information
automateddecision authored Aug 31, 2017
2 parents 84e82a7 + af628e1 commit 28b27d9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions MongoDataConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,14 @@ public function count($table) {
$count = $collection->find()->count();
return $count;
}

/**
* @param array $query Array with find parameters
* @return int model count
*/
public function countWithQuery($table, $query) {
$collection = $this->db->selectCollection($table);
$count = $collection->find($query)->count();
return $count;
}
}

0 comments on commit 28b27d9

Please sign in to comment.