指南针-无法使用指南针或其他方式连接到任何MongoDB Atlas数据库

我一直在尝试使用university.mongodb.com连接字符串连接到Atlas:

mongodb+srv://m001-student:m001-mongodb-basics@cluster0-jxeqq.mongodb.net/test

但是指南针GUI出现以下错误:

queryTxt ETIMEOUT cluster-0-jxeqq.mongodb.net

我创建了自己的集群,然后重试。但不幸的是,出现了相同的错误。我试图编写一个JavaSript代码(角度占位符中包含实际值):

const MongoClient = require('mongodb').MongoClient;
const uri = "mongodb+srv://<user>:<password>@cluster0.amffz.gcp.mongodb.net/<dbname>?retryWrites=true&w=majority";
const client = new MongoClient(uri,{ useNewUrlParser: true });
client.connect(err => {
    if (err) return console.log(err);
  const collection = client.db("test").collection("collection-1");
  client.close();
});

...这给了我这个错误:

Error: queryTxt ETIMEOUT cluster0.amffz.gcp.mongodb.net
  at QueryReqWrap.onresolve [as oncomplete] (dns.js:202:19) {
  errno: undefined,code: 'ETIMEOUT',syscall: 'queryTxt',hostname: 'cluster0.amffz.gcp.mongodb.net'
}

在Atlas中,我将“安全性”选项中的“网络访问”启用为: 0.0.0.0/0

我禁用防火墙只是为了确保连接未被阻止:

sudo ufw disable

但是似乎没有任何作用。

有帮助吗?

[编辑]

系统配置:Ubuntu 20.04 LTS

iCMS 回答:指南针-无法使用指南针或其他方式连接到任何MongoDB Atlas数据库

我发现我正在使用的计算机的连接出现问题。

我想出了解决此问题的方法。我卸载了MongoDB。似乎有一些配置问题。 我也删除了mongodb和mongoose npm软件包。 重新安装所有内容。和中提琴,它连接了!

本文链接:https://www.f2er.com/2080114.html

大家都在问