我正在使用mongodb atlas建议的标准连接
const MongoClient = require('mongodb').MongoClient;
const uri = "mongodb+srv://<username>:<password>@cluster0-4azjv.gcp.mongodb.net/test?retryWrites=true&w=majority";
const client = new MongoClient(uri, { useNewUrlParser: true });
client.connect(err => {
const collection = client.db("test").collection("devices");
// perform actions on the collection object
client.close();
});
我收到以下错误
TypeError: Cannot read property 'replace' of undefined
at matchesParentDomain (uri_parser.js:30)
at uri_parser.js:71
我已将0.0.0.0/0
列入白名单。
答案 0 :(得分:0)
我越关注这个问题,似乎前端和后端之间的区别就很大了。我遇到了bigquery
的类似问题。由于不想创建后端,因此创建了一个google cloud function
作为后端并使用了fetch
。这也适用于bigquery
。