5

I have used mLab previously with below connection string. Now I am hosting my app in Google App Engine with my mongodb instance on Google Compute Engine using Bitnami. When I create a instance, I couldn't find the connection string.

mLab connection string: mongodb://username:password@ds129010.mlab.com:29010/testdn

But know the username and password. what could be the connection string

what could be the connection string for Bitnami GCP Compute Engine VM instance.

username: root, password: test

1 Answers1

4

The External IP of the instance is the host for the mongodb to connect. The connection string would be

mongodb://username:password@<IP-of-the-instance>:27017/testcdn

NOTE:- Don't forget to open port 27017 from the VPC networks to access from outside the Compute Engine Instance like from your personal laptop

PFA the image depicting where to find the IP How to get External IP of an instance

Satpal Tanan
  • 1,108
  • 7
  • 17
  • How to open port 27017 from the VPC networks to access from outside the Compute Engine Instance – Prithvi Uppalapati Nov 18 '17 at 19:54
  • I have replace host with External Ip, username with 'root' and password with 'temperory password generate'... still i get { MongoError: Authentication failed. – Prithvi Uppalapati Nov 18 '17 at 20:32
  • The default mongodb installation is without password, so you could connect to it without username or password, so the connection string would be mongodb://:27017/testcdn – Satpal Tanan Nov 20 '17 at 06:15
  • To open the port for mongodb, check this post https://stackoverflow.com/questions/28776013/google-cloud-platform-cant-connect-to-mongodb – Satpal Tanan Nov 20 '17 at 06:17