Mongo Atlas: Connection authentication failed with custom databases

后端 未结 4 2169
迷失自我
迷失自我 2021-02-19 21:37

I am trying the Mongo Atlas Cloud. I create a cluster and i am trying a connection with the mongo shell: (same problem with mongo drivers)

mongo mongodb://***-cl         


        
4条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-19 22:06

    You authenticate with the admin database. From there you can switch the database.

    When connecting using Mongo drivers, your connection string needs add the auth source:

    /any_database?authSource=admin&replicaSet=xyz
    

提交回复
热议问题