Well recently I have installed MongoDB on my windows machine which is my local machine and I want to connect to it from a virtual machine in my Virtualbox. the vm is an ubuntu 16.04 and it's hosting my nginx webserver and also my php environment. what I want to do is to access my mongodb (which is on my local machine), from the vm. I have a network between these machines on a specific IP range like for my local and for the vm. they can ping each other. and I have access to port 80 of the vm from my local so I can see my hosted websites on the vm from a browser on my local machine.

when I try to connect to mongodb from a laravel app it shows me this error:

MongoDB/Driver/Exception/ConnectionTimeoutException with message 'No suitable servers found (`serverSelectionTryOnce` set): [connection timeout calling ismaster on '']'

im pretty sure its related to the ports and firewalls so I opened the 27017 port on my local machine but still no luck.

I want a way to test the connection between these two machines can anybody help be through this?

does mongodb also needs any configuration to let me access it from a network?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.