升级macOS Ventura13.5.1后MongoDB v7本地连接失败问题
解决MongoDB 7.0无法启动的兼容性问题
问题根源
MongoDB 7.0要求数据库的featureCompatibilityVersion最低为6.0,你的数据库当前保留的是5.0版本配置,导致7.0的mongod进程启动失败,因此无法建立连接。
解决步骤
停止当前MongoDB服务
brew services stop mongodb-community安装MongoDB 6.x版本作为过渡
brew install mongodb-community@6.0启动MongoDB 6.x服务
brew services start mongodb-community@6.0连接数据库并升级兼容性版本
打开mongosh执行以下命令:use admin db.adminCommand({ setFeatureCompatibilityVersion: "6.0" })可通过以下命令确认设置成功:
db.adminCommand({ getParameter: 1, featureCompatibilityVersion: 1 })切换回MongoDB 7.0版本
brew services stop mongodb-community@6.0 brew uninstall mongodb-community@6.0 brew install mongodb-community启动MongoDB 7.0服务
brew services start mongodb-community
完成以上步骤后,尝试用mongosh连接即可正常访问数据库。
内容的提问来源于stack exchange,提问作者VonHugenstein
相关产品推荐
相关产品推荐

