You are on page 1of 21

CouchDB

 시작하기  
Topic  
•  Document-­‐oriented  Database  
•  Documents  
•  Schema  Free  
•  RESTful  HTTP  API  
Document-­‐oriented  Database  
Document-­‐oriented  Database  
Document-­‐oriented  Database  
•  MongoDB(C++)  
•  CouchDB(Erlang)  
•  RavenDB(C#)  
Documents  
JSON  Document  Format  
Document  
{
"_id": "kyungw00k",
"profile": {
"nickname": "박사마",
"name": {
"firstname": "경욱",
"lastname": "박"
},
"birthdate": "1981-11-09”
}
SAME  AS  “CREATE  TABLE”  IN  SQL  
Document  
Schema  Free  
Schema  Free  
{  
     "_id":  "kyungw00k",  
     "profile":  {  
             "nickname":  "박사마",  
             "name":  {  
                     "firstname":  "경욱",  
                     "lastname":  "박"  
             },  
             "birthdate":  "1981-­‐11-­‐09",  
             "hasBrother":  false  
     }  
}  
SAME  AS  “ALTER  TABLE”  IN  SQL  
Schema  Free  
•  Document  Versioning!  

Rev  1   Rev  2  
RESTful  HTTP  API  
RESTful  HTTP  API  
•  Create  
–  HTTP  POST  /hello  
(hello라는  DB를 만든다.)  
–  HTTP  PUT  /hello/kyungw00k  
(“kyungw00k”  을  ID로 갖는  Document를 만든다.)  
•  Read  
–  HTTP  GET  /hello/kyungw00k  
(“kyungw00k”을  ID로 갖는  Document를 읽는다.)  
•  Update  
–  HTTP  PUT  /hello/kyungw00k  
(Create와 방법은 같지만  Document의  Revision이 다르다.)  
•  Delete  
–  HTTP  DELETE  /hello/kyungw00k  
(“kyungw00k”을 ID로 갖는  Document를 지운다.)  
RESTful  HTTP  API  
•  Read  
RESTful  HTTP  API  
•  Create(Rev1)  and  Update(Rev2)  

Rev  1   Rev  2  
뭐가 좋은걸까?  
Typical  3-­‐Tier  Architecture  
2-­‐Tier  Architecture  with  CouchDB  
No  Locking  
•  Mule-­‐Version  Concurrency  Control  (MVCC)  
Reference  

hfp://guide.couchdb.org/index.html  

You might also like