diff --git a/MongoDataConnection.php b/MongoDataConnection.php index 492cb1c..aac1472 100644 --- a/MongoDataConnection.php +++ b/MongoDataConnection.php @@ -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; + } }