0

How to connect the MongoDB database present in a virtual machine from another system or lap

I have a database created in the virtual machine. I want to connect to that database from my personal system using the IP of that Virtual machine.

Sujith Kumar
  • 872
  • 6
  • 19
  • Simply use the IP (the hostname would be even better) instead of `localhost` in the connection string. What did you try? – Wernfried Domscheit May 24 '23 at 05:28
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community May 24 '23 at 14:16
  • spring.data.mongodb.uri=mongodb://:27017/customer_db I was using the above in my Spring tool suite for connecting to mongo db compass .In place of IPadress i have given my system ip address. Before I was connecting llike this by giving localhost spring.data.mongodb.uri=mongodb://localhost:27017/customer_db..When i try connecting with my ip address getting the Following error.........Exception in monitor thread while connecting to server ipaddress:27017 com.mongodb.MongoSocketOpenException: Exception opening socket – abi rajasekar May 24 '23 at 14:35
  • @WernfriedDomscheit – abi rajasekar May 24 '23 at 15:33
  • Have a look at https://stackoverflow.com/questions/74609210/cant-connect-to-mongodb-6-0-server-locally-using-nodejs-driver/74610881#74610881 – Wernfried Domscheit May 24 '23 at 15:46

0 Answers0