-1

I have a client specific mongodb database. We have a node js based web app which is hosted on bluemix. I need to establish a connection between this web app and my client specific mongodb.

For which I think we need two things:

1) Client proxy details added in the code I push to the bluemix

2) Firewall tunnel established between the mongodb and the webapp.

I need help on how we can give proxy options to the function: mongoclient.connect(). The web search din't help. I am using mongodb package in nodejs.

Similar questions have been already asked but not answered.

Using mongoose and mlab behind a proxy

Connect to MongoDB database using mongoose behind a proxy

Anuja Parikh
  • 53
  • 1
  • 14
  • Please consider my proxy client solution [here](https://stackoverflow.com/a/49699452/5464788) that worked for me. – davejlin Apr 06 '18 at 19:09
  • Please consider my proxy client solution [here](https://stackoverflow.com/a/49699452/5464788) that worked for me. – davejlin Apr 06 '18 at 19:13
  • @davejlin your answer is for desktop connectivity, which is out of scope. – Marcel Feb 07 '19 at 13:01

1 Answers1

-1

I got the same error and solved it using global-tunnel npm package.

As you can see in the readme it's very easy to use, just add below code (updated with your correct info) and that's all:

var globalTunnel = require('global-tunnel');
globalTunnel.initialize({
  host: '10.0.0.10',
  port: 8080,
  sockets: 50 // optional pool size for each http and https 
});

Hope this helps,

  • Hi, my issue got solved by a very easy tweak. Adding the domain of the client to my mongodb hostname solved the issue for me. Thank you for your suggestion – Anuja Parikh Mar 30 '18 at 08:01
  • @AnujaParikh could you elaborate? (perhaps an edit on your question?) – KansaiRobot Dec 10 '18 at 02:40
  • @AnujaParikh were you able to connect to mongodb using this module? It seems it's only relevant for the management port (28017), and not for the mongodb protocol listening on 27017. Please elaborate. – Marcel Feb 07 '19 at 13:00