0

Is it somehow possible to run mongo in memory without occupying a port. The same way some embedded SQLs DBs work. We are currently using flapdoodle, but it seems it can only work on a separate port in a separate process. Is there a mongo-level limitation when prevents us from doing this? I want to run my Integration tests without exposing an additional port.

yuranos
  • 8,799
  • 9
  • 56
  • 65

2 Answers2

2

No, mongodb cannot be embedded that way. You can actually launch it as a sub-process from your java application or test, but as the java driver always communicates via tcp, you will not be able to go without a port.

mtj
  • 3,381
  • 19
  • 30
-2

Your MongoDB instance will be available at 127.0.0.1:27017 It is bound to the localhost by default and its configuration details can be found in /etc/mongod.conf. To connect to the test database with the MongoDB shell, simply run:

mongo

You can access your MongoDB instance remotely via an SSH tunnel using:

ssh -L 4321:localhost:27017 user@your.ip.address -f -N mongo --port 4321

Anju Prasad
  • 351
  • 2
  • 3