【问题标题】:Problem connecting mongodb with mongoose, after whitelisted my IP address将我的 IP 地址列入白名单后,将 mongodb 与 mongoose 连接时出现问题
【发布时间】:2020-07-15 09:19:47
【问题描述】:

我无法连接到我的 MongoDb 数据库。我检查了几次,我的 IP 地址在网络访问中正确列入白名单。我有以下信息:

  message:
   'Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that
you\'re trying to access the database from an IP that isn\'t whitelisted. Make sure your current IP address is on your Atlas cluster\'s IP whitelist: https://docs.atlas.mongodb.com/security-whitelist/',
  reason:
   TopologyDescription {
     type: 'ReplicaSetNoPrimary',
     setName: null,
     maxSetVersion: null,
     maxElectionId: null,
     servers:
      Map {
        'cluster0-shard-00-01-216w6.mongodb.net:27017' => [ServerDescription],
        'cluster0-shard-00-02-216w6.mongodb.net:27017' => [ServerDescription],
        'cluster0-shard-00-00-216w6.mongodb.net:27017' => [ServerDescription] },
     stale: false,
     compatible: true,
     compatibilityError: null,
     logicalSessionTimeoutMinutes: null,
     heartbeatFrequencyMS: 10000,
     localThresholdMS: 15,
     commonWireVersion: null } }
^C

【问题讨论】:

  • 能否请您说明您是如何将您的 IP 列入白名单的
  • 确保您的 IP 已列入白名单。
  • 我去了网络访问,我有我当前的 IP 地址,但那不起作用;

标签: node.js windows mongodb mongoose connection


【解决方案1】:

我遇到了同样的问题并通过以下方式解决了它:

  1. 转到“网络访问”。

  2. 在注册的 IP 地址上转到“编辑”操作。

  3. 如果您的 IP 地址已更改,您将看到允许访问当前 IP 地址的选项,单击该选项以更新 IP。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-10-08
    • 2021-01-06
    • 2021-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多