Created
August 14, 2019 14:32
-
-
Save mirsahib/0b7c50236837126b5cedba8cde1c1d1b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//database setting | |
var db_url = | |
"mongodb+srv://mirsahib24:[email protected]/rotten-pumpkin?retryWrites=true&w=majority"; | |
mongoose.connect(db_url, { useNewUrlParser: true }); | |
mongoose.connection.on("error", function(err) { | |
console.log(err); | |
console.log("Could not connect to mongodb"); | |
}); | |
mongo.MongoClient.connect(db_url, { useNewUrlParser: true }, function( | |
err, | |
client | |
) { | |
if (err) { | |
console.log("Could Not Connect DB"); | |
} else { | |
db = client.db("Test"); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment