Mongodb Server
mongod and Compass is running on Windows.
the Compass connection string is mongodb://localhost:27017/DB_NAME
the mongod.cfg is this:
storage:
dbPath: C:\Program Files\MongoDB\Server\6.0\data\db
journal:
enabled: true
systemLog:
destination: file
logAppend: true
path: C:\Program Files\MongoDB\Server\6.0\log\mongod.log
net:
port: 27017
bindIp: 0.0.0.0
replication:
replSetName: rs0
enableMajorityReadConcern: true
App
The app I’m trying to connect from, is running on Ubuntu WSL2 on the Windows machine mentioned above.
The app connection string is mongodb://HOST_IP:27017/DB_NAME, where HOST_IP IP is the address of the host machine, obtained by running the command cat /etc/resolv.conf, as shown here.
USER@WINDOWS:~$ cat /etc/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver [HOST_IP]