On Post installation go to below path
C: -> Program Files -> MongoDB -> Server -> 4.0(version) -> bin
In the bin directory, you’ll find an interesting couple of executable files.
- mongod
- mongo
mongod stands for “Mongo Daemon”. mongod is a background process used by MongoDB. The main purpose of mongod is to manage all the MongoDB server tasks. For instance, accepting requests, responding to client, and memory management.
mongo is a command line shell that can interact with the client (for example, system administrators and developers).
Now let’s see how we can get this server up and running. To do that on Windows, first you need to create a couple of directories in your C drive. Open up your command prompt inside your C drive and do the following:
C:\> mkdir data/dbC:\> cd dataC:\> mkdir db
The purpose of these directories is MongoDB requires a folder to store all data. MongoDB’s default data directory path is /data/db on the drive. Therefore, it is necessary that we provide those directories like so.
After creating those two files, head over again to the bin folder you have in your mongodb directory and open up your shell inside it. Run the following command:
mongod
Voilà! Now our MongoDB server is up and running! ?
In order to work with this server, we need a mediator. So open another command window inside the bind folder and run the following command:
mongoAfter running this command, navigate to the shell which we ran mongod command (which is our server). You’ll see a ‘connection accepted’ message at the end. That means our installation and configuration is successful!
Just simply run in the mongo shell:
db
Setting up Environment Variables:
Advanced System Settings -> Environment Variables -> Path(Under System Variables) -> Edit
Simply copy the path of our bin folder and hit OK! In my case it’s C:\Program Files\MongoDB\Server\4.0\bin
No comments:
Post a Comment