MongoDB
 sql >> Datenbank >  >> NoSQL >> MongoDB

MongoError:Zeitüberschreitung bei Verbindung 0 zu localhost:27017

const mongoose = require('mongoose');
const option = {
    socketTimeoutMS: 30000,
    keepAlive: true,
    reconnectTries: 30000
};

const mongoURI = process.env.MONGODB_URI;
mongoose.connect(mongoURI, option).then(function(){
    //connected successfully
}, function(err) {
    //err handle
});