You've successfully subscribed to MyPad Blog
Great! Next, complete checkout for full access to MyPad Blog
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info is updated.
Billing info update failed.

Starting mongod with parameters from the command line

Starting mongod with parameters from the command line

Here is a quick post on using mongodb for a problem I face occassionally! (actually more often than I'd expect!)

Starting mongodb custom configuration

I typically start mongodb on my Macbook using the following command which is setup for authorization etc.

mongod --config /usr/local/etc/mongod.conf

The config file is as follows:

  dbPath: /Users/santosh/data/db
  authorization: enabled

It basically sets up the directory for storage, bind the service to be accessible locally (i.e not exposed by default) and has authorization enabled.

Starting mongodb without authetication

At times, I have the need to run mongodb without authentication to speed up few toy projects.

My typical procedure so far used to be to go the conf file, set authorization to false and then start the server. This is cumbersome!

Go back revert the changes, etc. ... back and forth!

This is a PITA ... until now.

Starting the server with custom parameters is straight-forward as mentioned here.

The following command does the job for me! ;-)

mongod --dbpath "/Users/santosh/data/db"