【发布时间】:2020-05-28 03:22:16
【问题描述】:
我正在尝试 Mongo Atlas Cloud。我创建了一个集群,并尝试与 mongo shell 建立连接:(与 mongo 驱动程序相同的问题)
mongo mongodb://***-cluster-shard-00-00-***.mongodb.net:27017,***-cluster-shard-00-01-***.mongodb.net:27017,***-cluster-shard-00-02-***.mongodb.net:27017/any_database?replicaSet=****-Cluster-shard-0 --ssl --username ***** --password *****
这是文档中的连接字符串。这是错误:
MongoDB shell version: 3.2.7
connecting to: mongodb://***-cluster-shard-00-00-***.mongodb.net:27017,***-cluster-shard-00-01-***.mongodb.net:27017,***-cluster-shard-00-02-***.mongodb.net:27017/any_database?replicaSet=***-Cluster-shard-0
2016-07-07T01:31:17.535-0300 I NETWORK [thread1] Starting new replica set monitor for ***-Cluster-shard-0/***-cluster-shard-00-00-***.mongodb.net:27017,***-cluster-shard-00-01-***.mongodb.net:27017,***-cluster-shard-00-02-***.mongodb.net:27017
2016-07-07T01:31:17.535-0300 I NETWORK [ReplicaSetMonitorWatcher] starting
2016-07-07T01:31:20.084-0300 E QUERY [thread1] Error: Authentication failed. :
DB.prototype._authOrThrow@src/mongo/shell/db.js:1441:20
@(auth):6:1
@(auth):1:2
exception: login failed
只有当我使用 admin 数据库 "/admin?" 时才能连接到数据库在连接字符串中。
问题:
我需要使用控制台或 mongo 驱动程序连接到自定义数据库。
PD:我用“***”保护我的数据
【问题讨论】: