Node.js - Пн goose UnhandledPromiseRejectionWarning: Ошибка: queryTxt - PullRequest
0 голосов
/ 09 июля 2020

Я пытаюсь подключить свое приложение Node.js к Mongodb Atlas. Это код, который я использую:

const express = require("express");
const app = express();
const mongoose = require("mongoose");
const _ = require("lodash");

mongoose.connect("mongodb+srv://admin-name:******@cluster0.tlksq.mongodb.net/fruitsDB", { useNewUrlParser: true, useUnifiedTopology: true });

Я пробовал все, что знаю, используя подключение к кластеру в Atlas, но продолжаю получать эту ошибку:

(node:11660) UnhandledPromiseRejectionWarning: Error: queryTxt ETIMEOUT cluster0.tlksq.mongodb.net
    at QueryReqWrap.onresolve [as oncomplete] (dns.js:206:19)
(node:11660) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:11660) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Я не знаю если это связано с блоком catch, говорят они, но возможно ли это с помощью mon goose? если это возможно, как мне это использовать? Спасибо вам огромное!

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...