Think/Db/Driver/Mongo.php
public function getFields($tableName = '')
    {
        if (!empty($tableName) && $tableName != $this->_collectionName) {
            $this->switchCollection($tableName, '', false);
        }
        $this->queryTimes++;
        if ($this->config['debug']) {
            $this->queryStr = $this->_dbName.'.'.$this->_collectionName.'.findOne()';
        }
        try {
            $this->debug(true);
            $result = $this->_collection->findOne();
            $this->debug(false);
        } catch (\MongoCursorException $e) {
            E($e->getMessage());
        }
        if ($result) {
            // 存在数据则分析字段
            $info = [];
            foreach ($result as $key => $val) {
                $info[$key] = [
                    'name' => $key,
                    'type' => getType($val),
                ];
            }

            return $info;
        }

        // 暂时没有数据 返回false
        return false;
    }
public function getFields($tableName = '')
    {
        if (!empty($tableName) && $tableName != $this->_collectionName) {
            $this->switchCollection($tableName, '', false);
        }
        $this->queryTimes++;
        if ($this->config['debug']) {
            $this->queryStr = $this->_dbName.'.'.$this->_collectionName.'.findOne()';
        }
        try {
            $this->debug(true);
            $result = $this->_collection->findOne();
            $this->debug(false);
        } catch (\MongoCursorException $e) {
            E($e->getMessage());
        }
        if ($result) {
            // 存在数据则分析字段
            $info = [];
            foreach ($result as $key => $val) {
                $info[$key] = [
                    'name' => $key,
                    'type' => getType($val),
                ];
            }

            return $info;
        }

        // 暂时没有数据 返回false
        return false;
    }
取得数据表的字段信息
@param string $tableName
@return array