You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

升级macOS Ventura13.5.1后MongoDB v7本地连接失败问题

解决MongoDB 7.0无法启动的兼容性问题

问题根源

MongoDB 7.0要求数据库的featureCompatibilityVersion最低为6.0,你的数据库当前保留的是5.0版本配置,导致7.0的mongod进程启动失败,因此无法建立连接。

解决步骤

  1. 停止当前MongoDB服务

    brew services stop mongodb-community
    
  2. 安装MongoDB 6.x版本作为过渡

    brew install mongodb-community@6.0
    
  3. 启动MongoDB 6.x服务

    brew services start mongodb-community@6.0
    
  4. 连接数据库并升级兼容性版本
    打开mongosh执行以下命令:

    use admin
    db.adminCommand({ setFeatureCompatibilityVersion: "6.0" })
    

    可通过以下命令确认设置成功:

    db.adminCommand({ getParameter: 1, featureCompatibilityVersion: 1 })
    
  5. 切换回MongoDB 7.0版本

    brew services stop mongodb-community@6.0
    brew uninstall mongodb-community@6.0
    brew install mongodb-community
    
  6. 启动MongoDB 7.0服务

    brew services start mongodb-community
    

完成以上步骤后,尝试用mongosh连接即可正常访问数据库。

内容的提问来源于stack exchange,提问作者VonHugenstein

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.12 17:00:29