U
U
UncleDenn2018-09-21 13:23:56
JavaScript
UncleDenn, 2018-09-21 13:23:56

Why Authentication failed in mongodb?

I'm trying to connect to the mlab service where the mongo base is located, but it gives Authentication failed
user created

const express = require('express');
const mongoose = require('mongoose');
const bodyParser = require('body-parser');

const app = express();

//bodyparser Mibbbleware
app.use(bodyParser.json());

//DB
const db = require('./config/keys').mongoURI;

console.log(db);
//Connect to mongo
mongoose.connect(db, {useNewUrlParser:true}, {useMongoClient: true})
    .then(() => console.info('MongoDB connected'))
    .catch(err => console.error(err));

const port = process.env.PORT || 3000;

app.listen(port, () => console.info('server started on port: ' + port));

module.exports = {
    mongoURI: 'mongodb://мойЮзер:пароль@ds111623.mlab.com:11623/react_app'
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question