protected function _all($where = [], $fields = [], $order = null, $direction = null, $limit = null, $page = null) { $collection = $this->getTable(); $opts = Db::opts($fields, $order, $direction, $limit, $page); $cursor = $collection->find($where, $opts); $results = []; foreach ($cursor as $c) { $converted = $this->_convert($c); if ($converted->_id) { $key = Utils::getMongoID($converted->_id); $results[$key] = $converted; } else { $results[] = $converted; } } return $results; }