Introduction to MongoDB Command Line options

Rama Sagar
Posted by in NoSql category on for Beginner level | Points: 250 | Views : 4818 red flag
Rating: 5 out of 5  
 1 vote(s)

MongoDB (from "humongous") is a cross-platform document-oriented database system. Classified as a NoSQL database, MongoDB eschews the traditional table-based relational database structure in favor of JSON-like documents with dynamic schemas


In this article we will know other command line options in MongoDb,we will also see how to install mongodb as a service and how to verify the server.

Previous article has provided about the introduction of mongodb & Set up and installation


The objective of the article is to know about command line options in Mongo db and how to install as a service and to verify the server..

Now lets start the mongo server as shown in previous article

Mongo has many command line options we can use lets look at few 

Type the following command
mongod --help | more

It has the ability to log more verbosely or less into a specific log file 

  1. It has the ability to run on a different TCP port.
  2. we can have more connections.
  3. we can specify different directory where data files should reside.

Let us see how to specify different directory and to provide high verbosity level which logs everything..

Specific Data Directory

We will have to specify a different data directory so lets create that directory


md \dotnetfunda\db

Now lets create a Text document inside dotnetfunda folder

The above is the configuration file being used for the mongo server. Data files will be residing in the dotnetfunda\db directory and store in log in dotnetfunda/mongo-server.log and to log very very verbosely i am specifying 5 v's here  where 1 being least verbose and 5 being most verbose..

Now we are ready to start the mongo server using the configuration file 


mongod -f c:\dotnetfunda\mongod.conf
-f for the configuration file 
c:  is the path where the configuration file exists 

The server is started and it is indicating that all its output is going to log file which we have provided 

we can also inspect what is in that log file by the command 

more c:\dotnetfunda\mongo-server.log

It was showing all the verbose logging that the server produced


In this article we have learned different command line options in mongodb and the example of specifying different directory.In next article we will see how to install mongo as a service..


Page copy protected against web site content infringement by Copyscape

About the Author

Rama Sagar
Full Name: RamaSagar Pulidindi
Member Level: Silver
Member Status: Member,MVP
Member Since: 12/30/2012 1:51:40 AM
Country: India
A Software Profesional working in Microsoft .NET technologies since year 2008, and I work for Dake ACE. I am passionate about .NET technology and love to contribute to the .NET community at Dot Net Funda

Login to vote for this post.

Comments or Responses

Login to post response

Comment using Facebook(Author doesn't get notification)