Reputation: 11
I need your help to connect my mongodb database to the cluster atlas, I configured my IP, username and password. I'm using heroku to deploy. Thanks for help! But I can't , see bellow:
express: "^4.17.1", express-session: "^1.17.0", mongoose: "^5.8.3",
const mongoose = require('mongoose');
const db = { mongoURI: 'mongodb+srv://username:[email protected]/test?retryWrites=true&w=majority' }
mongoose.Promise = global.Promise;
mongoose.connect(db.mongoURI, {
useUnifiedTopology: true,
useNewUrlParser: true
}).then(() => {
console.log('Successfully');
}).catch((err) => {
console.log('Error: ' + err);
});
Upvotes: 1
Views: 78
Reputation: 11
I've added my IP to the whitelist and IP anywhere but isn't working. I read the link, but I don't understand how it can me help, sorry..
Upvotes: 0