在Heroku上部署了一个Node.js应用程序,现在我正在尝试连接数据库。我顺利进行了所有步骤,直到不得不使用mongo "mongodb+srv://<app name>-da9ev.mongodb.net/test" --username admin
通过终端将它们连接起来为止。我收到的答案很吸引人,因为它说外壳程序和服务器不匹配(并且确实匹配,测试了几次),并且隐式会话正在运行:
cassiano$ mongo "mongodb+srv://<app name>-hugcu.gcp.mongodb.net/test" --username admin
MongoDB shell version v4.2.1
Enter password:
connecting to: mongodb://<app name>-shard-00-00-hugcu.gcp.mongodb.net:27017,<app name>-shard-00-01-hugcu.gcp.mongodb.net:27017,<app name>-shard-00-02-hugcu.gcp.mongodb.net:27017/test?authSource=admin&compressors=disabled&gssapiServiceName=mongodb&replicaSet=<app name>-shard-0&ssl=true
2019-11-06T11:45:03.277+0100 I NETWORK [js] Starting new replica set monitor for <app name>-shard-0/<app name>-shard-00-00-hugcu.gcp.mongodb.net:27017,<app name>-shard-00-01-hugcu.gcp.mongodb.net:27017,<app name>-shard-00-02-hugcu.gcp.mongodb.net:27017
2019-11-06T11:45:03.278+0100 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to <app name>-shard-00-01-hugcu.gcp.mongodb.net:27017
2019-11-06T11:45:03.278+0100 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to <app name>-shard-00-02-hugcu.gcp.mongodb.net:27017
2019-11-06T11:45:03.278+0100 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to <app name>-shard-00-00-hugcu.gcp.mongodb.net:27017
2019-11-06T11:45:03.402+0100 I NETWORK [ReplicaSetMonitor-TaskExecutor] Confirmed replica set for <app name>-shard-0 is <app name>-shard-0/<app name>-shard-00-00-hugcu.gcp.mongodb.net:27017,<app name>-shard-00-01-hugcu.gcp.mongodb.net:27017,<app name>-shard-00-02-hugcu.gcp.mongodb.net:27017
Implicit session: session { "id" : UUID("5987a296-2121-41ac-b671-0a57fda6da7a") }
MongoDB server version: 4.0.13
WARNING: shell and server versions do not match
MongoDB Enterprise <app name>-shard-0:PRIMARY>
有人可以帮我调试吗?我不能说它是否是版本问题,某些未完成的会话或什么。预先感谢您的可用性