I have a mongodb hosted on an EC2 instance. The securirty group allows port 27017 and in mongo.conf, the port binding is set to 0.0.0.0. I am able to connect to this mongo instance using the mongo CLI on my machine, so it means the server is accessable and port/ip binding is not the problem. But, I can connect using my MongoDb Compass application. It gives me this error:
Authentication failed.
This is what my connection string looks like:
mongodb://myuser:mypwd@my-ec2-ip:27017/myDatabase
This is the same connection string I use to connect via the mongo CLI on my machine:
mongo "mongodb://myuser:mypwd@my-ec2-ip:27017/myDatabase" and this works. What am I doing wrong?