Answer the question
In order to leave comments, you need to log in
Error when turning on the server on mongodb what to do?
Wrote:
MongoClient.connect('mongodb://localhost:27017/alldatabase', function(err, database) {
useUnifiedTopology: true;
useNewUrlParser: true;
if (err) {
return console.log(err);
}
// Ссылка на бд
db = database;
app.listen(3000, function() {
console.log('Подключение');
});
});
Answer the question
In order to leave comments, you need to log in
Apparently a bug in MongoClient.connect
// Запуск сервера
MongoClient.connect('mongodb://localhost:27017/alldatabase', function(err, database) {
useUnifiedTopology: true; // <---????
useNewUrlParser: true; // <---???? неправильно опции установлены
...
// Запуск сервера
MongoClient.connect(
'mongodb://localhost:27017/alldatabase', // строка подключения
{
useUnifiedTopology: true, // установка опций
useNewUrlParser: true
},
function(err, database) { // callback
if (err) {
return console.log(err);
}
// Ссылка на бд
db = database;
app.listen(3000, function() {
console.log('Подключение');
});
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question