Cant connect to specific db name in connection string as mongo

im trying to connect to a specific db since im using mongoose, but i cant for some reason since i recieve " Failed Authentication " message, im using this mongoose code :

  • as you can see, i have my specific "OAuth2" db in the connection string, but i recieve failed Authentication, knowing that "mongo" is the superadmin since i want to insert specific data from my code to a specific db

const mongoose = require('mongoose');

module.exports = function() {
  mongoose.connect('mongodb://mongo:qtdWsTVICWBEJpLOuOGUuIOyABfKmRWB@monorail.proxy.rlwy.net:44466/OAuth2', { useNewUrlParser: true, useUnifiedTopology: true })
    .then(() => console.log('MongoDB connected'))
    .catch(err => console.error('MongoDB connection error:', err));
};

0 Replies