500 Internal Server Error
localhost:27017: Read timed out after reading 0 bytes, waited for 30.000000 seconds [/var/www/vhosts/project/lib/db/mongo/mapper.php:238]
But working here and also pagination is working too.
https://example.com/project/member/index
public function index($f3){
list($filter, $filter_array) = $this->_buildFilter($f3);
$mapper = new \DB\Mongo\Mapper($f3->get('MongoDB'),'members');
$page =1;
$limit = 50;
if(isset($args['page'])){
$page = $args['page'] ;
$limit = 200;
}
if(empty($args["page"])) {
$args["page"] = 0;
}
$filter_get='';
if(is_array($filter)){
$filter_get = http_build_query($filter);
}
$options['order']= array('_id'=>-1);
$content = $mapper->paginate($args["page"], $limit, $filter_array, $options
);
....
}
protected function _buildFilter($f3) {
$args = $f3->get("GET");
$filter = array();
foreach($args as $key => $val) {
if(!empty($val) && !is_array($val)) {
$filter[$key] = $val;
}
}
unset($val);
$filters_array = array();
foreach($filter as $i => $val) {
if($i == "siteId" && !empty($val)) {
$filters_array['$and'][]['siteId'] = $val;
}
}
return array($filter, $filters_array);
}
mapper.php:238
function count($filter=NULL,$ttl=0) {
$fw=\Base::instance();
$cache=\Cache::instance();
if (!($cached=$cache->exists($hash=$fw->hash($fw->stringify(
[$filter])).'.mongo',$result)) || !$ttl ||
$cached[0]+$ttl<microtime(TRUE)) {
$result=$this->collection->count($filter?:[]);
if ($fw->get('CACHE') && $ttl)
// Save to cache backend
$cache->set($hash,$result,$ttl);
}
return $result;
}