CouchDB Getting Start
Simon Su
●
○
○
●
●
●
●
● Install: http://wiki.apache.org/couchdb/Installation
configuration
query
replocate
REST server
user auth.
management
status check
● [GET] http://ipaddress:5984/database/column_key
●
●
https://peihsinsu.gitbooks.io/docker-note-book/content/common-docker-couchdb.html
Replicate
{
"_id":"1350783674236",
"_rev":"1-fed6ba9a837d66c8fb086b32294d5f7d",
"sessionid":"1350783674236",
"data":[
{
"player":"3WAUD..EZOHQ",
"name":"Caesar Chi",
"score":2
}
]
}
function(doc) {
if(doc.data){
for(var i = 0 ; i < doc.data.length ; i++ ) {
if(doc.data[i].player && doc.data[i].score){
emit({player:doc.data[i].player,name:doc.data[i].name}, doc.data[i].score);
}
}
}
}
列舉data並以
({player: player_id, name: player_name}: score)
建立View
Source:
一筆scores資料
Result:
一筆view資料
function(key, values, rereduce){
return sum(values);
}
將原資料型態({player: player_id, name:
player_name}: score)其中的Score以作分
組(group by key)加總
Source:
以{user資訊: 答對題目數}
為資料型態的資料
Result:
以user資訊為群組,加總答對題目
數,建立相同資料型態的資料
partial string cannot
fuzzy here...
201411
interval cannot use
here...
●
CouchDB Getting Start
CouchDB Getting Start
CouchDB Getting Start
CouchDB Getting Start
CouchDB Getting Start

CouchDB Getting Start