Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (47.6k points)

So, I'm sure I'm missing something simple here, but when I run mongo as a daemon (using mongod --fork or just mongod), I see different database content than if I just run "mongo" on the host machine.

My only assumption is that the data is being stored somewhere other than /data/db when it's running just the shell, and switches to /data/db when I boot the mongod. In that case, how do I get at my data when running mongod?

2 Answers

0 votes
by (106k points)
  • mongod is the "Mongo Daemon" it's basically the host process for the database. When you start.
  • mongod you're basically saying "start the MongoDB process and run it in the background"
  • mongod has several default parameters, such as storing data in /data/db and running on port 27017.
  • mongo is the command-line shell that connects to a specific instance of mongod. When you run mongo with no parameters it defaults to connecting to the localhost on port 27017. If you run mongo against an invalid machine: port combination then it will fail to connect (and tell you as much).
0 votes
by (107k points)

Mongod(Short for Mongo Daemon) is a framework process used by MongoDB server to get things done. This method is responsible for managing the whole MongoDB server tasks such as accepting requests, responding to users, managing memory requirements of MongoDB server operations and other things essential for MongoDB Server to run.

Whereas Mongo is a JavaScript shell interface to MongoDB, that shows a powerful interface for system administrators as well as a way for developers to examine queries and operations directly with the database which also provides a fully functional JavaScript environment for use with a MongoDB

Related questions

0 votes
2 answers
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Oct 18, 2019 in Web Technology by Sammy (47.6k points)
0 votes
2 answers

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...