I have created mongodb user with command
use admin db.createUser( { user: \"superuser\", pwd: \"12345678\", roles: [ \"root\" ] } )
mongoose.createConnection('mongodb://username:password@35.238.xxx.xxx:27017/dashboards?authSource=admin', { useNewUrlParser: true }, (e) => { if (e) throw console.error('Error connecting to mongo database master'); console.log('Connected to mongo database master.'); });