<?php
namespace App\Models\demo\mongo;

use Api\PhpUtils\Mongo\Base;

class User extends Base
{
    protected static $instance;

    protected static $db_config_index = 'metro';

    protected function getCollectionName()
    {
        return 'user';
    }

    protected function getWhere($params)
    {
        $where = [];
        if (isset($params['name']) && !empty($params['name'])) {
            $where['name'] = $params['name'];
        }
        return $where;
    }

    protected function getQueryOptions()
    {
        $options = [
            'projection' => [
                'mobile' => 1
            ],
            'maxTimeMS' => 800,
            'limit' => 5,
            'sort' => ['mobile' => -1]
        ];
        return $options;
    }
}
