MongoDBのRESTインタフェースを使う

http://www.mongodb.org/pages/viewpage.action?pageId=7831865

27017でふだんmongodbを起動していると、+1000したport 28017でhttpで管理画面が出る
http://localhost:28017


さらに起動時に--restを付けると

mongod run --config /usr/local/Cellar/mongodb/1.8.2-x86_64/mongod.conf --rest


http getとpostで操作できるようになってる

curl 'http://localhost:28017/test/chats/'
{ 
  "offset" : 0,
  "rows": [

  ],

  "total_rows" : 0 ,
  "query" : {} ,
  "millis" : 0
}
curl -d '{name : "shokai", "msg" : "hello"}' 'http://localhost:28017/test/chats/'
{ "ok" : true }
curl 'http://localhost:28017/test/chats/'
{ 
  "offset" : 0,
  "rows": [
    { "_id" : { "$oid" : "4e29eb2a7dbc0db109b117bc" }, "name" : "shokai", "msg" : "hello" }
  ],

  "total_rows" : 1 ,
  "query" : {} ,
  "millis" : 0
}
curl -d '{name : "shokai", "msg" : "hello work"}' 'http://localhost:28017/test/chats/'
{ "ok" : true }
curl 'http://localhost:28017/test/chats/'
{
  "offset" : 0,
  "rows": [
    { "_id" : { "$oid" : "4e29eb2a7dbc0db109b117bc" }, "name" : "shokai", "msg" : "hello" } ,
    { "_id" : { "$oid" : "4e29eba77dbc0db109b117bd" }, "name" : "shokai", "msg" : "hello work" }
  ],

  "total_rows" : 2 ,
  "query" : {} ,
  "millis" : 0
}
> use test
switched to db test
> db.chats.find()
{ "_id" : ObjectId("4e29eb2a7dbc0db109b117bc"), "name" : "shokai", "msg" : "hello" }
{ "_id" : ObjectId("4e29eba77dbc0db109b117bd"), "name" : "shokai", "msg" : "hello work" }