Create a database
curl -X PUT --noproxy localhost http://localhost:5984/ex01
Register data
curl -X PUT --noproxy localhost http://localhost:5984/ex01/cat -d@cat.json
curl -X PUT --noproxy localhost http://localhost:5984/ex01/biking -d@biking.json
curl -X PUT --noproxy localhost http://localhost:5984/ex01/hello -d@hello.json
Register a program
curl -X PUT --noproxy 127.0.0.1 http://127.0.0.1:5984/ex01/_design/ex01 --data-binary @ex01.json
Execute the program
curl --noproxy 127.0.0.1 http://127.0.0.1:5984/ex01/_design/ex01/_view/foo

{"total_rows":3,"offset":0,"rows":[
{"id":"hello","key":"2009/01/15 15:52:20","value":"Hello World"},
{"id":"biking","key":"2009/01/30 18:04:11","value":"Biking"},
{"id":"cat","key":"2009/02/17 21:13:39","value":"Bought a Cat"}
]}
Register another program
curl -X PUT --noproxy 127.0.0.1 http://127.0.0.1:5984/ex01/_design/ex02 --data-binary @ex02.json
Execute the program
curl --noproxy 127.0.0.1 http://127.0.0.1:5984/ex01/_design/ex02/_view/foo

{"total_rows":3,"offset":0,"rows":[
{"id":"biking","key":"Biking","value":"My biggest hobby is mountainbiking. The other day..."},
{"id":"cat","key":"Bought a Cat","value":"I went to the the pet store earlier and brought home a little kitty..."},
{"id":"hello","key":"Hello World","value":"Well hello and welcome to my new blog..."}
]}

couchapp

couchapp generate helloworld
cd helloworld
couchapp generate show hello
cd shows/
vi hello.js
cd ..
export http_proxy=""
couchapp push testdb
Access

http://127.0.0.1:5984/testdb/_design/helloworld/_show/hello

hello3.js
function(doc, req) {
	var str_out = "*** Hello World! ***<br />";
	str_out += "*** Good Afternoon ***<br />";
	str_out += req.query.who + "<br />>;
	return str_out;
}
http://127.0.0.1:5984/testdb/_design/helloworld/_show/hello3?who=Taro

_attachments

_attachments/hello.html

http://localhost:5984/testdb/_design/helloworld/hello.html

views

BASE="http://localhost:5984/example03"
#
curl -X DELETE --noproxy localhost $BASE
curl -X PUT --noproxy localhost $BASE
#
curl -X PUT --noproxy localhost $BASE"/a01" -d@a01.json
curl -X PUT --noproxy localhost $BASE"/a02" -d@a02.json
curl -X PUT --noproxy localhost $BASE"/a03" -d@a03.json
curl -X PUT --noproxy localhost $BASE"/a04" -d@a04.json
curl -X PUT --noproxy localhost $BASE"/a05" -d@a05.json
#
couchapp generate myapp
cd myapp
couchapp generate view ex01
map.js
reduce.js
http://127.0.0.1:5984/example03/_design/myapp/_view/ex01

{"rows":[ {"key":null,"value":13300} ]}

lists

views/ex01/map.js

lists/list01.js

http://127.0.0.1:5984/testdb/_design/myapp/_list/list01/ex01


myapp/views/ex02/map.js
http://127.0.0.1:5984/librivox/_design/myapp/_view/ex02?key="Japanese"
http://127.0.0.1:5984/librivox/_design/myapp/_view/ex02?key="Polish"

Return

Nov/26/2013 AM 08:15