using a mongoose.connect() to connect to a mongodb instance on ec2 using a mongoose.connect() to connect to a mongodb instance on ec2 mongoose mongoose

using a mongoose.connect() to connect to a mongodb instance on ec2


It seems that you didn't create an user for the database you're trying to connect. I will to connect MongoDB using the admin user and create it:

mongo admin --username root --password rootpassword --host ec2-xx-xxx-x-xxx.us-west-2.compute.amazonaws.com --port 27017MongoDB shell version: XXXconnecting to: x.x.x.x:27017/admin> db = db.getSiblingDB('databasename')databasename> db.createUser( { user: "username", pwd: "password", roles: [ "readWrite", "dbAdmin" ]} ){ "user" : "username", "pwd" : "...", "roles" : [  "readWrite",  "dbAdmin" ], "_id" : ObjectId("...")}> exit