Mongod vs mongos vs mongo CONCEPTS

Hi there ,

I know that those concepts are explained in the video , but I think a topic talking a little bit about them would be helpfull. Please help me clarify the difference between them.

Basically, when you get to the end of m103 you should be able to know the difference between mongo , mongod and mongos processes and commands and what which one of those do.

Mongod :

From what I understand , mongod is almost like an API.
It’s the middleman between the application and the db. It handles data requests, manages data access, and performs background management operations.

Mongos :

Mongos is also a middleman.
The mongos instances route queries and write operations to the shards in a sharded cluster.
Would it be fair to say it does the same as mongod ? What’s the big difference ?

Mongo:

When I run the command " mongo --port xxxx"
I’am connecting to the cluster / replica itself and not starting a middleman like the previous processes.

Useful links :

Hi @Simao_Bonvalot,

Well you are almost right about the difference between these 3, but let me clarify it for you in a little different way.

So, The MongoDB is divided into a two components server and client.

The server is the main database component which stores and manages data. And, the clients come in various flavours and connect to the server to perform various queries and db operations.

Here, Mongod is the server component. You start it, it runs, that’s it.

By definition we also call it the primary daemon process for the MongoDB database which handles data requests, manages data access, and performs background management operations.

Whereas Mongo is a default command line client. You start it, you connect to a server, you enter commands, you exit out of it.

You have to run mongod first, otherwise you have no database to interact with.

Now, the question comes then what is Mongos?
So, Mongos is a kind of query router, providing an interface between client applications and the sharded cluster. [Follow the link for more details]

Here, I am also sharing some additional documentation links which you can go through for more detailed understanding.

MongoDB Package Components
MongoDB Sharding: Concepts, Examples

I hope it clarifies your doubt.
It was a great question. Thanks for asking…:slightly_smiling_face:
In case of any further questions, please feel free to reach out to us.

:100:
Kind Regards,
Kushagra