0

Подключаю mongo. Выводит ошибки. Не могу понять их значимость и что править???Помогите, подскажите, пожалуйста.

const express = require('express') const mongoose = require('mongoose') ....

mongoose.connect("mongodb://localhost:5000/danart", { useNewUrlParser: true }); mongoose.set('useCreateIndex', true);

Ошибки вот такие в терминале выводит:

[nodemon] restarting due to changes... [nodemon] starting node index index.js Server has been started on 5000 //показывает что сервер подключен, а вот дальше.....????? (node:5816) UnhandledPromiseRejectionWarning: # (node:5816) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a prom ise which was not handled with .catch(). (rejection id: 1) (node:5816) [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-z ero exit code.

4
  • И что, после этого программа завершает работу?
    – Dmytro
    7 дек 2018 в 15:18
  • MongoError: Authentication failed. Пишет такую ошибку. Как ее решить?
    – kikker
    10 дек 2018 в 8:38
  • 1
    Чтобы ее решить, нужно авторизироваться в БД. При подключении, в опциях укажите авторизационные данные mongodb.github.io/node-mongodb-native/3.1/api/…
    – Dmytro
    10 дек 2018 в 8:50
  • благодарю!Все чудесно
    – kikker
    11 дек 2018 в 7:56

0

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Посмотрите другие вопросы с метками или задайте свой вопрос.