1. Start your mongod process with command "mongod --rest"
2. Hit http://localhost:28017 in you browser
->It should list you some system admin data.
3. Try to hit the url http://localhost:28017/listDatabases?text=1
->It should have given list of databases as a JSON response. For example I had bellow
{ "databases" : [
{ "name" : "blog",
"sizeOnDisk" : 218103808,
"empty" : false },
{ "name" : "course",
"sizeOnDisk" : 218103808,
"empty" : false },
{ "name" : "m101",
"sizeOnDisk" : 218103808,
"empty" : false },
{ "name" : "mydb",
"sizeOnDisk" : 218103808,
"empty" : false },
{ "name" : "pcat",
"sizeOnDisk" : 218103808,
"empty" : false },
{ "name" : "school",
"sizeOnDisk" : 218103808,
"empty" : false },
{ "name" : "students",
"sizeOnDisk" : 218103808,
"empty" : false },
{ "name" : "test",
"sizeOnDisk" : 218103808,
"empty" : false },
{ "name" : "local",
"sizeOnDisk" : 1,
"empty" : true } ],
"totalSize" : 1744830464 }
4. You could see list of commands supported over REST at the following location
5. To lists all documents under "posts" collection in "blog" database
6. To see a specific document in posts collection with query {author="narayan"}
Following link gives some comprehensive note on this HTTP interface. Read and benefit!!!
http://docs.mongodb.org/ecosystem/tools/http-interfaces/
http://docs.mongodb.org/ecosystem/tools/http-interfaces/
What link "gives some comprehensive note on this HTTP interface"? Looks like that's missing from the post. Otherwise, great information, thanks!
ReplyDeleteI think he was talking about this link http://docs.mongodb.org/ecosystem/tools/http-interfaces/
ReplyDeleteI missed while posting. Thanks Gregory Smirnov for posting answer!
DeleteThanks!
ReplyDelete