Think/Db/Driver/Mongo.php
public function count(array $options = [])
    {
        if (isset($options['table'])) {
            $this->switchCollection($options['table'], '', false);
        }
        $this->model = $options['model'];
        $this->queryTimes++;
        $query = $this->parseWhere(isset($options['where']) ? $options['where'] : []);
        if ($this->config['debug']) {
            $this->queryStr = $this->_dbName.'.'.$this->_collectionName;
            $this->queryStr .= $query ? '.find('.json_encode($query).')' : '';
            $this->queryStr .= '.count()';
        }
        try {
            $this->debug(true);
            $count = $this->_collection->count($query);
            $this->debug(false);

            return $count;
        } catch (\MongoCursorException $e) {
            E($e->getMessage());
        }
    }
public function count(array $options = [])
    {
        if (isset($options['table'])) {
            $this->switchCollection($options['table'], '', false);
        }
        $this->model = $options['model'];
        $this->queryTimes++;
        $query = $this->parseWhere(isset($options['where']) ? $options['where'] : []);
        if ($this->config['debug']) {
            $this->queryStr = $this->_dbName.'.'.$this->_collectionName;
            $this->queryStr .= $query ? '.find('.json_encode($query).')' : '';
            $this->queryStr .= '.count()';
        }
        try {
            $this->debug(true);
            $count = $this->_collection->count($query);
            $this->debug(false);

            return $count;
        } catch (\MongoCursorException $e) {
            E($e->getMessage());
        }
    }
统计记录数
@param array $options 表达式
@return array