ThinkPHP6使用mongodb报错Authentication failed.

这是因为框架链接mongodb没有指定database

到目录下 vendor/topthink/think-orm/src/db/connector/Mongo.php下修改

            if (empty($config['dsn'])) {
                $config['dsn'] = 'mongodb://' . ($config['username'] ? "{$config['username']}" : '') . ($config['password'] ? ":{$config['password']}@" : '') . $config['hostname'] .($config['hostport'] ? ":{$config['hostport']}" : ''). ($config['database'] ? "/{$config['database']}" : '');
            }

 

上一篇:java中遇到break findIndex解析


下一篇:WordPress 内存缓存加速插件:Batcache