test mongodb

to start mongo in REST mode, use ./bin/mongod --dbpath ./data/db -rest

 

to access it by REST, use https://github.com/tdegrunt/mongodb-rest(other approach http://www.mongodb.org/display/DOCS/Http+Interface)

 

to install mongodb-rest, use npm. install npm. you need use root mode. after install, to find where is command, use "npm bin" to show where is bin direcotry. It is not within default path.

 

use curl -d '{ "A1" : 201 }' -H "Content-Type: application/json" http://localhost:3000/test/example1 to create data. Here Chinese character is supported.

  -d means --data, -H means header

 

then http://localhost:28017/test/example1/ will show the data you just added. the all '/' in url are necessary.

 

So to add data, you need 1) start mogodb demon, 2)start mongodb-rest server, 3) use curl to add

 

to query, access http://localhost:28017/test/example1/?filter_A1=我草

Oh, cool, it support Chinese.

 

1. 如果出现node.js Error: Cannot find module './colors',用export NODE_PATH=/opt/local/lib/node_modules/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值