MongoDB on Ubuntu – REST is not enabled. use –rest to turn on Error

MongoDB is really becoming a very popular NoSQL data store. This is specially due to its features and also due to its adoption in many popular applications like craiglist, foursquare,, intuit, sourceforge etc. the list goes on. The complete list can be found here

Installing MongoDB on Ubuntu is fairly straightforward. Just issue the command:

$ sudo apt-get install mongodb

Once installed it basically runs on the native driver port 27017. It also exposes a http server on port 28017 which can be accessed via browser. Now when you try to browse the URL it displays the landing page for MongoDB. Now there is a link to list all the commands:


Clicking on this we might get this error:


This is because the http server on port 28017 communicates with the MongoDB server on port 27017 via REST interface which is not enabled by default.

To enable this we need to make change to /etc/mongodb.conf file. This is a read only file so we need to open with sudo.

$ sudo vim /etc/mongodb.conf


As mentioned in the above screenshot we can add the command for enabling the rest.

Once this is done we need to restart the MongoDB server.

$ sudo restart mongodb

Now we can browse the URL and we should be able to see all the commands.