GUI access to Mongo DB inside UTM VM

Mongo DB server is listening at port 27017 inside a VM. Inside this VM, my code connect to this DB using mongodb:localhost:27017/ successfully.

Now if I have a Mongo DB GUI tool such as Compass trying to look inside , how do I connect to the Mongo DB running inside the VM?

The same way you connected to it without Compass, but inside of compass. Route it through the VM hiarchy to where the server is.

Make sure you have network pass through and so on as appropriate to the VM itself, you’ll essentially connect to the VM just like you would any other remote server, and then from the remote server into the MongoDB Database.

The hard part in answering this, is this depends all on how you’ve configured your host system, your VM, and MongoDB.

Thank you, Brock.
I am using UTM VM and like you said I need to check what is the configuration of my host, guest, VM and MongoDB.
I will update here for a resolution.

@Universal_Simplexity something you can use to make this all easier is instead of a VM or in addition to your VM (set network as pass through of this is academic, otherwise build a proxy and yada yada) is setup Docker to host MongoDB, and then setup Kubernetes to handle all of the network and routing services to MongoDB.

You could also use Mininet as well.

Sounds like a good idea because MongoDB failed to start even after thoroughly removed the current 6.0.4 community edition installation and installed the latest 6.0.5 using instructions.

I should perform the installation on my native MacOS?

For me I’m a big DevOps guy personally, I use Docker and Kubernetes anytime that I can, because it’s SO easy to setup once you understand it. Can spin up, route and connect anything etc. handle encryptions, firewalls, all of that jazz. I try to avoid VMs unless it’s going to host things like as a server. Then I’ll make a host VM and load it with containers and internetwork the containers.

Then route between VM servers using mininet to a similar way you’d network if you had physical racked servers connected to a network switch etc.

Even an M1 Mac Mini with 8 GB of RAM can handle a lot of MongoDB, web servers etc. the largest container is my Apollo GraphQL which serves as a replication sync, and data transit node to orchestrate data between an 11 node MongoDB replica set, 5 Redis DB replica sets, and 5 CouchDB replica sets. All in 100% sync with 3GB of RAM allocated to it.

I am completely new to containers too and have a deadline to complete an assignment to query MongoDB across collections.
What is my best MVP environment?

Honestly just Docker will work, lots of guides to spin it up and run MongoDB as a microservice.

I dont know how long you have, but sometime next week I’ll be publishing a Node.JS and Python microservice guide to build a MongoDB cluster/replica set.


YouTube has a bunch of tutorials, but here’s a great one. Have you up and working in 10 mins.

1 Like

By the end of this week.
Node JS and MongoDB accessed via Mongoose is my minimal requirement to deliver a RESTful API microservice to find favourite movies against movies dataset from Kaggle given a userid.

Out of curiosity …
Why would this happen even after a full installation?

Mar 30 09:59:45 simplexity2204 systemd[1]: Started MongoDB Database Server.
Mar 30 09:59:45 simplexity2204 systemd[12475]: mongod.service: Failed to locate executable /usr/bin/mongod: No such file or directory
Mar 30 09:59:45 simplexity2204 systemd[12475]: mongod.service: Failed at step EXEC spawning /usr/bin/mongod: No such file or directory

That could several things from not having collections and DB built, to bad installation. Tbh I’ve never seen that error. Typically I just use Linux or Apple.

Node and Mongoose connections:

error === {message : "Client must be connected before running operations "}
i am facing this type of error some many times i worked it but i don’t know that bug fix