📅  最后修改于: 2022-03-11 15:04:17.856000             🧑  作者: Mango
var os = require('os');
var database_uri;
if(os.hostname().indexOf("local") > -1)
// Server running on Localhost
database_uri = "mongodb://localhost/database";
else
// Server running on remote server
database_uri = "mongodb://remotehost/database";