I am having problems establishing a connection to a remotely hosted MongoDB instance.
I think I have tried almost everything I could find to resolve it but nothing has worked, including:
Multiple different edits of bindIp mongod.conf,to allow separate IPs, for example:
bindIp: 127.0.0.1,<my-public-web-app-ip>
bindIp: 127.0.0.1;<my-public-web-app-ip>
bindIp: [127.0.0.1,<my-public-web-app-ip>]
bindIp: ["127.0.0.1,<my-public-web-app-ip>"]
None of these worked. I couldn't even get Mongo to either restart successfully after any of the changes above.
Mongo restart and access to the Mongo shell is only possible using, bindIp: 127.0.0.1
I have a ufw firewall configured to allow access from the IP of the machine which I want to access the DB to port 27017, where Mongo is available on my VPS.
I have used sudo systemctl restart mongod and checked that Mongo is running with sudo systemctl status mongod with every change to try to identify the specific problem, but Mongo simply won't start with any of the bindIp configurations I try.
I have created and recreated Mongo admin users and tried again with new credentials in the connect sting in Compass without any luck.
My Mongo version is v4.4.9. I have seen mostly suggestions for versions below this.
If anyone has any ideas how this can be resolved I'd be very grateful.