I am using Mongodb on Windows where My whole project in ubuntu by WSL2. when I tried to connect my local mongodb server, I got not found error.
I tried to connect through my windows ip which is (mongodb://192.168.x.x:27017)
but unfortunately this method is not working. even if I tried to connect this url in mongodb compass on same machine it also doesn't work.
I also have another windows Pc in same WIFI. how Can I access My Windows mongodb
server from another PC. and How Can I access my Mongodb from wsl. please help.
thanks in advance.
I was Got Stuck for almost half day with this problem. Atlast I found solution for this.
ipconfig
command in this My ip was 192.168.X.X
you should find with same format.(mongodb://192.168.X.X:27017)
instead of default mongodb://localhost:27017
. if though default was working but with my pc IP? that wasn't warking for me.C:/Program Files/Mongodb/Sever/$VERSION/bin/mongod.cfg
this file in Admin mode. and# network interfaces
net:
port: 27017
bindIp: 0.0.0.0 # default was 127.0.0.1
now My mongodb is accessible from any machine in LAN (local are network)
thank you.