MongoDB ships with a web-based administrative tool. You can see this tool by going to http://localhost:28017/
You can see a bunch of stuff on the administrative tool screen. here is a partial image.
There are a bunch of links that you can click as well. If you click on any of the links on top
List all commands | Replica set status</p>
<p>Commands: buildInfo cursorInfo features hostInfo isMaster listDatabases replSetGetStatus serverStatus top
You get the following message
REST is not enabled. use --rest to turn on. check that port 28017 is secured for the network too.
So here is how you can fix that, open the config file mongod.cfg
In my case, I have the following there, yours will look different
logpath=C:NoSQLmongodblogmongo.log dbpath=C:NoSQLmongodbdata
Add the line rest=true
at the bottom, so that it becomes
logpath=C:NoSQLmongodblogmongo.log dbpath=C:NoSQLmongodbdata rest=true
Here is what it looks like when opened in notepad.
Save it, restart the MongoDB service. If you want to learn how to have MongoDB run as a service on Windows, take a look at Creating MongoDB as a service on Windows 8, the process should be the same for Windows 7
If you click on List all commands you will see a list of all the commands. Here is an image of a partial list
Scroll down to hostinfo and click on it you will see the following output
{ "system" : { "currentTime" : { "$date" : "Sun Feb 24 09:43:31 2013" }, "hostname" : "Denis", "cpuAddrSize" : 64, "memSizeMB" : 4095, "numCores" : 2, "cpuArch" : "x86_64", "numaEnabled" : false }, "os" : { "type" : "Windows", "name" : "Microsoft Windows 8", "version" : "6.2 (build 9200)" }, "extra" : { "pageSize" : 4096 } }
You can now bookmark some of the most used commands, hostinfo for example is http://localhost:28017/hostInfo?text=1
Go ahead and play around with the tool, check out all the links and also explore some of the commands that are listed
That is all for this post, if you are interested in my other MongoDB posts, you can find them here:
Install MongoDB as a Windows Service
How to sort results in MongoDB
Indexes in MongoDB: A quick overview
Multidocument updates with MongoDB
MongoDB: How to include and exclude the fields you want in results
MongoDB: How to limit results and how to page through results
MongoDB: How to backup and restore databases
MongoDB: How to restore collections
MongoDB: How to backup all the databases with one command
MongoDB: Exporting data into files
MongoDB: How to drop databases and collections
MongoDB: Creating capped collections
MongoDB: Returning documents where fields are null or not existing