node.js - 将我的 IP 地址列入白名单后,将 mongodb 与 mongoose 连接时出现问题
问题描述
我无法连接到我的 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 地址的选项,单击该选项以更新 IP。
推荐阅读
- spring - 同步执行状态动作
- reactjs - 如何在 React native 的嵌套数组中选中和取消选中复选框?
- javascript - 我无法在 socketcluster 的 socket.on 中访问我的变量
- c# - 如何使用rest api为现在服务史诗或用户故事中的引用字段设置值
- node.js - 如何在 test-cafe 中使用数据发出 post 请求?
- c# - Web API 使用 C# 向 SQL Server 发布身份验证
- angular - 如何使用 Angular js 在 ionic 4 中显示图像
- angular - angular/cdk 简单拖动不适用于带有 ngFor 的 div
- flutter - 如何仅从 DateTime.now() 中提取时间;
- c - 迭代 C 中的列表时,我是否看到优化错误?