これで問題は解決しました:
var options = {
server: {
socketOptions: {
keepAlive: 300000, connectTimeoutMS: 30000
}
},
replset: {
socketOptions: {
keepAlive: 300000,
connectTimeoutMS : 30000
}
}
};
次に、ここに入力します:
if(process.env.MONGODB_URI) {
mongoose.connect(process.env.MONGODB_URI, options);
} else {
// Connect to local database
}