What does pataquets/mongodb-proxy this image exactly do? And how to configure this - node.js

Docker Pull Command: docker pull pataquets/mongodb-proxy
I am trying to figure out a way for connecting my nodejs backend to mongodb atlas, but through a proxy server.
This is because only the IP of the proxy server is whitelisted in mongoDB Atlas. I want to know if I can connect my backend to the mongodb atlas through the proxy server and I do not want to whitelist my nodejs server in mongodb atlas.
So trying to implement the same, I got this docker image, could anyone help me out with, does this image serve for this purpose, and what it is used for and how can I configure it.
As I could not find a detailed documentation, and I could not understand the documentation provided in the docker hub.
Thank you

Related

Alternatives for connecting MongoDB Atlas to Heroku Node.js app

I've been working on a simple website using node.js, express, and MongoDB, with Heroku as the platform. I had a lot of issues early on trying to connect to my MongoDB Atlas cluster, resulting in Heroku throwing request timeout errors.
After some googling, I surmised that the issue was that the IP addresses Heroku sends requests to my DB from weren't whitelisted in Atlas. The simplest solution at that point was to egregiously set up so that any IP is considered whitelisted. Which actually works fine currently.
My actual question comes down to the fact that whitelisting all IPs hardly seems like a professional way to go about doing things.
What is a better solution?
You should only allow those IPs from which your application will connect to MongoDB Atlas. Allow all IPs is a bad practice and could make that MongoDB instance vulnerable.

I cannot connect to MongoDB Atlas database even though my IP is whitelisted

I am trying to connect to a mongoDB Atlas cluster using my node app, it wasn't working so I tried it with the mongoDB Compass. It shows timeout error. I can't figure out the problem, I have already whitelisted my IP from the database.
I am behind a proxy (my college has a proxy) but I even tried it with mobile data but it still won't work.

Connecting to a mongoDB with a TCP prefix on a NodeJS application

I created a NodeJS app that connects with a MongoDB and it seems to work locally.
Now, after hosting the NodeJS application on a remote machine, I am trying to connect to a mongoDB that was already created on that machine. When I print out some of the environment variables, the only one I see of relevance seems to be :
MONGODB_PORT: 'tcp://172.30.204.90:27017',
I tried connecting like I usually do with
mongoose.connect('mongodb://localhost:27017/metadata/')
and replacing it with mongoose.connect('tcp://172.30.204.90:27017/metadata') but I get an error that says my URI needs to start with 'mongodb'.
So I tried replacing it with mongoose.connect('mongodb://172.30.204.90:27017/metadata') and it no longer throws any error. But on the MongoDB side I don't see any new connections happening and my app does not start up on the machine. What should I be putting in the URI?
Your URI should indeed start with mongodb:
mongoose.connect('mongodb://username:password#host:port/database?options...');
See this page for more information: https://docs.mongodb.com/manual/reference/connection-string/
Did you try to connect to the database from cli? Or Telnet to see that connection isn't blocked.

Changes need to run mongoose on server instead of localhost?

What are the changes I need to run my app on server instead of localhost
mongoose.connect('mongodb://mongoServerIP/dbName)
Since you are running your mongo in your local, you are using localhost. I am not familiar with heroku server, but in general case, you first need to make sure mongo db is running on your heroku server and than you need to put that IP instead of localhost in the above command.
Please refer http://mongoosejs.com/docs/connections.html in case you need login credentials to access the server or any other reference.

I want to connect openshift mongodb database from my local client tools

I have my premium openshift account
I have all types of access in openshift
I have ssh key & user's credentials
I have MongoVUE & Robomongo & others client tools to open mongodb database.
when I try to open any local mongodb database then its working fine
but I want to directly connect my mongodb database of openshift server to mongoVUE or any else
so I can see which data is in my server database.
I have tried so many times to connect locally but it can connect to openshift but can not connect with mongodb database so please provide some good & exact steps so I can connect it.
I use mongovue also. Just do a
'rhc port-forward '
Then run mongovue using the Mongodb credentials that OPENSHIFT gave you.
Steps.
rhc port-forward <app-name>
Wait a couple of seconds. You then should see something like this.
Then run Mongovue. Add a connection and enter in your Openshift Mongodb credentials like this:
Save, Select your connection, and press connect. It should work.
You should have been given you mongodb credentials when you added the mongodb cartridge. You can also ssh into your app and do a "env" and see your mongodb password and username.
Finally I got perfect tool for it to connect with mongodb with server database in which we can perform all kind of CRUD operations.
we can use Robomongo tool for it which doesn't require paid version to perform CRUD operation.
Robomongo is available here
http://robomongo.org/download.html
mongoVUE requires paid version.
I use Robomongo. Just do a 'rhc port-forward '
Then run Robomongo using the Mongodb credentials that OPENSHIFT gave you.
Steps.
rhc port-forward
Wait a couple of seconds. You then should see something like this.
port forward image
Then run Robomongo. Add a connection and enter in your Openshift Mongodb credentials:

Resources