SlideShare a Scribd company logo
1 of 58
Download to read offline
Apache CouchDB 0.9.0
リリース記念資料
id:yssk22

http://d.hatena.ne.jp/yssk22
CouchDB復習
1.
ドキュメント指向
JSONのデータを
ためる入れ物
{
quot;_idquot;   :   quot;文書1quot;
quot;_revquot; :    quot;リビジョンquot;
quot;titlequot; :   quot;CouchDBについてquot;
quot;Contentquot;   : quot;いろいろquot;
}
2. Web+DB
REST
HTTP
3.
非リレーショナル
MapReduce
:= SQLめんどう
HTTP Request



HTTP                   map



HTTP Response
                   reduce
4.
Replication
http://couch.io/CouchDB-Intro-EU.pdf
のP.32からみるとおもしろい
0.9.0の話
Changes (公式より)
•   Modular configuration.
•   Performance enhancements for document and view access.
•   More resilient replication process.
•   Replication streams binary attachments.
•   Administrator role and basic authentication.
•   Document validation functions in design documents.
•   Show and list functions for rendering documents and views as
    developer controlled content-types.
•   External process server module.
•   Attachment uploading from Futon.
•   Etags for views, lists, shows, document and attachment
    requests.
•   Miscellaneous improvements to build, system integration, and
    portability.
目玉?
Show and list functions
for rendering documents
and views as developer
controlled content-types.
Blogアプリで考える。
タイトル、タグ、 内容
文書のIDは日付で。
Couch Db.0.9.0.Pub
Couch Db.0.9.0.Pub
アプリケーション
サーバー丌要論
特に
RESTful/RESTonlyな
アプリケーションは
CouchDBでOK
RESTful Rails
Controller#index
Controller#show
Controller#new
Controller#craete
Controller#update
Controller#edit
Controller#destroy
RESTful Rails
Controller#index
Controller#show
Controller#new       省略
Controller#craete
Controller#update
Controller#edit
Controller#destroy
JavaScriptで
Renderingを書く
Show
RESTful Rails
Controller#index
Controller#show
Controller#new
Controller#craete
Controller#update
Controller#edit
Controller#destroy
{
    quot;_idquot;: quot;_design/testquot;,
    quot;_revquot;: quot;9-938762531quot;,
    quot;languagequot;: quot;javascriptquot;,
    quot;viewsquot;: {
    },
    quot;showsquot;: {
       quot;displayquot;: quot;(function (doc, req) {if
(doc) {return ¥quot;<h1>¥quot; + doc.title +
¥quot;</h1><div>¥quot;+ doc.content + ¥quot;</div>¥quot;;}
else {if (req.docId) {return ¥quot;New
World¥quot;;} else {return ¥quot;Empty
World¥quot;;}}})quot;
    }
GET
      DB    デザインドキュメントのID


/my_blog/_design/test/_show/
display/2009_04_20_1
shows のキー   レンダリングするドキュメントのID
<h1>今日は疲れた
</h1><div><p>CouchDBの機能
調査をしていたけどドキュメントがな
い</p></div>
Restful Rails でいうと
ころの、show をやって
くれる
IDにマッチする文書が
見つからなければ
HTML Formを返すとか
Controller#new,
Controller#edit
相当はできる!
list
RESTful Rails
Controller#index
Controller#show
Controller#new
Controller#craete
Controller#update
Controller#edit
Controller#destroy
{
    quot;_idquot;: quot;_design/testquot;,
    quot;_revquot;: quot;9-938762531quot;,
    quot;languagequot;: quot;javascriptquot;,
    quot;viewsquot;: {
    },
    quot;listsquot;: {
   quot;simplequot;: quot;(function (head, row, req,
row_info) {if (row) {return {body: ¥quot;<h1>¥quot; +
row.key + ¥quot;</h1>¥quot; + ¥quot;<h2>¥quot; +
row.value.title + ¥quot;</h2>¥quot; + ¥quot;<div>¥quot; +
row.value.content + ¥quot;</div>¥quot;}; } else if
(head) {return {body: ¥quot;<h1>My Blog (¥quot; +
head.total_rows + ¥quot;件のエントリ)</h1>¥quot;};} else
{return {body: ¥quot;</ul>¥quot; + ¥quot;<p>前へ: ¥quot; +
(row_info ? row_info.first_key : ¥quot;¥quot;) + ¥quot; 次
へ: ¥quot; + (row_info ? row_info.prev_key : ¥quot;¥quot;) +
¥quot;</p>¥quot;};}})quot;
}
}
simple:
function (head, row, req, row_info) {
                       本体
   if (row) {
     return {
       body:
       quot;<h1>quot; + row.key + quot;</h1>quot; +
       quot;<h2>quot; + row.value.title + quot;</h2>quot; +
       quot;<div>quot; + row.value.content + quot;</div>quot;
     };
   } else if (head) { ヘッダ
     return {
       body:
       quot;<h1>My Blog (quot; + head.total_rows + quot;件のエントリ)</h1>quot;};
                      フッタ
   } else {
     return {
       body: quot;<p>前へ: quot; +
           (row_info ? row_info.first_key : quot;quot; ) +
           quot; 次へ: quot; +
           (row_info ? row_info.prev_key : quot;quot;) +
           quot;</p>quot;
     };
   }
})
GET
 /my_blog/_design/test/_list/
simple/posts_by_date
lists のキー   MapReduce View のキー
Couch Db.0.9.0.Pub
RESTful Rails でいうとこ
ろの、Controller#index
をやってくれるもの
MapReduce からレンダリ
ングまでイッキに。
コンテント
ネゴシエーション
もできる
JavaScript Runtime の初期化時に、
以下の要領でType設定
registerType(quot;allquot;, quot;*/*quot;);
registerType(quot;textquot;, quot;text/plainquot;, quot;txtquot;);
registerType(quot;htmlquot;, quot;text/htmlquot;);
registerType(quot;xhtmlquot;, quot;application/xhtml+xmlquot;, quot;xhtmlquot;);
registerType(quot;xmlquot;, quot;application/xmlquot;, quot;text/xmlquot;, quot;application/x-xmlquot;);
registerType(quot;jsonquot;, quot;application/jsonquot;, quot;text/x-jsonquot;);
registerType(quot;jsquot;, quot;text/javascriptquot;, quot;application/javascriptquot;, quot;application/x-
javascriptquot;);
registerType(quot;cssquot;, quot;text/cssquot;);
registerType(quot;icsquot;, quot;text/calendarquot;);
registerType(quot;csvquot;, quot;text/csvquot;);
registerType(quot;rssquot;, quot;application/rss+xmlquot;);
registerType(quot;atomquot;, quot;application/atom+xmlquot;);
registerType(quot;yamlquot;, quot;application/x-yamlquot;, quot;text/yamlquot;);
registerType(quot;multipart_formquot;, quot;multipart/form-dataquot;);
respondWith で返す!
return respondWith(req, {
       html : function() {
          return {
            body:quot;<p>Ha ha, you said ¥quot;quot; + doc.word + quot;¥quot;.quot;
          };
       },
       xml : function() {
          return {
            body: quot;<xml ...>quot;
          };
       },
       fallback : quot;htmlquot;
      });
3XX とかもOK
return {quot;codequot;: 303, quot;bodyquot;: quot;See
Otherquot;, quot;headersquot;: {quot;Locationquot;: quot;/quot;}};
0.9.0 新機能!
•Show and list functions
 for rendering documents
 and views as developer
 controlled content-types.
0.9.0 新機能(その他)!
•一言で
Basic 認証とデータバリ
デーションができるように
なって、いろいろ既存機
能向上した
jQuery と CouchDB
でアプリは完成できる!?
あと、Apache mod*があると便利
余談:
CouchDBで作ると
おもしろそうなアプリ
OpenSocial
Container
OpenSocial
Container の要件
JavaScript (gadgets)
+ REST (API)
+ KV Store (Persistence)
これはCouch
Couch Db.0.9.0.Pub
• 公式
 ▫ http://couchdb.apache.org/
• ドキュメント(違
 ▫ http://localhost:5984/_utils/couch_tests.html?script/
   couch_tests.js

• OpenSocial with CouchDB
 ▫ http://github.com/yssk22/webjourney/tree/opensoci
   al
 ▫ まだ何もつくっていない
 ▫ 開発者募集中
    Apache Shindig と jQuery と (必要があればRails)でなんと
     かなるんじゃないかと。

• id:yssk22 が記述するすべてのコンテンツは個人の意見
  であり、勤務先の組織とは一切無関係のものです。

More Related Content

What's hot

Presentasi Kelompok 25 PW A+B
Presentasi Kelompok 25 PW A+BPresentasi Kelompok 25 PW A+B
Presentasi Kelompok 25 PW A+BHapsoro Permana
 
Tugas pw [kelompok 25]
Tugas pw [kelompok 25]Tugas pw [kelompok 25]
Tugas pw [kelompok 25]guest0ad6a0
 
Zero One Or Many Namespaces
Zero One Or Many NamespacesZero One Or Many Namespaces
Zero One Or Many NamespacesLiquidHub
 
Zen codingcheatsheet
Zen codingcheatsheetZen codingcheatsheet
Zen codingcheatsheetgoldenveizer
 
Devclub Servicemix Jevgeni Holodkov 23 04 09
Devclub Servicemix Jevgeni Holodkov 23 04 09Devclub Servicemix Jevgeni Holodkov 23 04 09
Devclub Servicemix Jevgeni Holodkov 23 04 09helggeist
 
JSUG - TU Wien Castor Project by Lukas Lang
JSUG - TU Wien Castor Project by Lukas LangJSUG - TU Wien Castor Project by Lukas Lang
JSUG - TU Wien Castor Project by Lukas LangChristoph Pickl
 
Coding for marketers
Coding for marketersCoding for marketers
Coding for marketersRobin Lord
 
zynga-online.facebook.html
zynga-online.facebook.htmlzynga-online.facebook.html
zynga-online.facebook.htmladmin999
 

What's hot (12)

Presentasi Kelompok 25 PW A+B
Presentasi Kelompok 25 PW A+BPresentasi Kelompok 25 PW A+B
Presentasi Kelompok 25 PW A+B
 
Tugas pw [kelompok 25]
Tugas pw [kelompok 25]Tugas pw [kelompok 25]
Tugas pw [kelompok 25]
 
Css
CssCss
Css
 
Usecase
UsecaseUsecase
Usecase
 
Zero One Or Many Namespaces
Zero One Or Many NamespacesZero One Or Many Namespaces
Zero One Or Many Namespaces
 
Zen codingcheatsheet
Zen codingcheatsheetZen codingcheatsheet
Zen codingcheatsheet
 
Opensocial Codelab
Opensocial CodelabOpensocial Codelab
Opensocial Codelab
 
my test
my testmy test
my test
 
Devclub Servicemix Jevgeni Holodkov 23 04 09
Devclub Servicemix Jevgeni Holodkov 23 04 09Devclub Servicemix Jevgeni Holodkov 23 04 09
Devclub Servicemix Jevgeni Holodkov 23 04 09
 
JSUG - TU Wien Castor Project by Lukas Lang
JSUG - TU Wien Castor Project by Lukas LangJSUG - TU Wien Castor Project by Lukas Lang
JSUG - TU Wien Castor Project by Lukas Lang
 
Coding for marketers
Coding for marketersCoding for marketers
Coding for marketers
 
zynga-online.facebook.html
zynga-online.facebook.htmlzynga-online.facebook.html
zynga-online.facebook.html
 

Similar to Couch Db.0.9.0.Pub

Ajax On S2 Odp
Ajax On S2 OdpAjax On S2 Odp
Ajax On S2 Odpghessler
 
Page Caching Resurrected
Page Caching ResurrectedPage Caching Resurrected
Page Caching ResurrectedBen Scofield
 
What's new in Rails 2?
What's new in Rails 2?What's new in Rails 2?
What's new in Rails 2?brynary
 
Anvita Dynamic Fontson Web Feb2001
Anvita Dynamic Fontson Web Feb2001Anvita Dynamic Fontson Web Feb2001
Anvita Dynamic Fontson Web Feb2001guest6e7a1b1
 
Relaxing With CouchDB
Relaxing With CouchDBRelaxing With CouchDB
Relaxing With CouchDBleinweber
 
development, ruby, conferences, frameworks, ruby on rails, confreaks, actsasc...
development, ruby, conferences, frameworks, ruby on rails, confreaks, actsasc...development, ruby, conferences, frameworks, ruby on rails, confreaks, actsasc...
development, ruby, conferences, frameworks, ruby on rails, confreaks, actsasc...ActsAsCon
 
Developing and testing ajax components
Developing and testing ajax componentsDeveloping and testing ajax components
Developing and testing ajax componentsIgnacio Coloma
 
Merb Pluming - The Router
Merb Pluming - The RouterMerb Pluming - The Router
Merb Pluming - The Routercarllerche
 
JWU Guest Talk: JavaScript and AJAX
JWU Guest Talk: JavaScript and AJAXJWU Guest Talk: JavaScript and AJAX
JWU Guest Talk: JavaScript and AJAXHilary Mason
 
OSCON 2004: XML and Apache
OSCON 2004: XML and ApacheOSCON 2004: XML and Apache
OSCON 2004: XML and ApacheTed Leung
 
Surfacing External Data Through Magnolia
Surfacing External Data Through MagnoliaSurfacing External Data Through Magnolia
Surfacing External Data Through MagnoliaSeanMcTex
 
Migration testing framework
Migration testing frameworkMigration testing framework
Migration testing frameworkIndicThreads
 
Building Web Interface On Rails
Building Web Interface On RailsBuilding Web Interface On Rails
Building Web Interface On RailsWen-Tien Chang
 
Html and i_phone_mobile-2
Html and i_phone_mobile-2Html and i_phone_mobile-2
Html and i_phone_mobile-2tonvanbart
 
Jade & Javascript templating
Jade & Javascript templatingJade & Javascript templating
Jade & Javascript templatingwearefractal
 

Similar to Couch Db.0.9.0.Pub (20)

Javascript Basic
Javascript BasicJavascript Basic
Javascript Basic
 
Ajax On S2 Odp
Ajax On S2 OdpAjax On S2 Odp
Ajax On S2 Odp
 
Merb jQuery
Merb jQueryMerb jQuery
Merb jQuery
 
Seam Glassfish Slidecast
Seam Glassfish SlidecastSeam Glassfish Slidecast
Seam Glassfish Slidecast
 
Page Caching Resurrected
Page Caching ResurrectedPage Caching Resurrected
Page Caching Resurrected
 
What's new in Rails 2?
What's new in Rails 2?What's new in Rails 2?
What's new in Rails 2?
 
Anvita Dynamic Fontson Web Feb2001
Anvita Dynamic Fontson Web Feb2001Anvita Dynamic Fontson Web Feb2001
Anvita Dynamic Fontson Web Feb2001
 
Relaxing With CouchDB
Relaxing With CouchDBRelaxing With CouchDB
Relaxing With CouchDB
 
development, ruby, conferences, frameworks, ruby on rails, confreaks, actsasc...
development, ruby, conferences, frameworks, ruby on rails, confreaks, actsasc...development, ruby, conferences, frameworks, ruby on rails, confreaks, actsasc...
development, ruby, conferences, frameworks, ruby on rails, confreaks, actsasc...
 
Developing and testing ajax components
Developing and testing ajax componentsDeveloping and testing ajax components
Developing and testing ajax components
 
Merb Pluming - The Router
Merb Pluming - The RouterMerb Pluming - The Router
Merb Pluming - The Router
 
JWU Guest Talk: JavaScript and AJAX
JWU Guest Talk: JavaScript and AJAXJWU Guest Talk: JavaScript and AJAX
JWU Guest Talk: JavaScript and AJAX
 
Front End on Rails
Front End on RailsFront End on Rails
Front End on Rails
 
Php Sq Lite
Php Sq LitePhp Sq Lite
Php Sq Lite
 
OSCON 2004: XML and Apache
OSCON 2004: XML and ApacheOSCON 2004: XML and Apache
OSCON 2004: XML and Apache
 
Surfacing External Data Through Magnolia
Surfacing External Data Through MagnoliaSurfacing External Data Through Magnolia
Surfacing External Data Through Magnolia
 
Migration testing framework
Migration testing frameworkMigration testing framework
Migration testing framework
 
Building Web Interface On Rails
Building Web Interface On RailsBuilding Web Interface On Rails
Building Web Interface On Rails
 
Html and i_phone_mobile-2
Html and i_phone_mobile-2Html and i_phone_mobile-2
Html and i_phone_mobile-2
 
Jade & Javascript templating
Jade & Javascript templatingJade & Javascript templating
Jade & Javascript templating
 

More from Yohei Sasaki

20120317 CloudFoundry #pyfes
20120317 CloudFoundry #pyfes20120317 CloudFoundry #pyfes
20120317 CloudFoundry #pyfesYohei Sasaki
 
MongoDB on CloudFoundry
MongoDB on CloudFoundryMongoDB on CloudFoundry
MongoDB on CloudFoundryYohei Sasaki
 
MongoDB on CloudFoundry
MongoDB on CloudFoundryMongoDB on CloudFoundry
MongoDB on CloudFoundryYohei Sasaki
 
CouchDB JP & BigCouch
CouchDB JP & BigCouchCouchDB JP & BigCouch
CouchDB JP & BigCouchYohei Sasaki
 
BPStudy32 CouchDB 再入門
BPStudy32 CouchDB 再入門BPStudy32 CouchDB 再入門
BPStudy32 CouchDB 再入門Yohei Sasaki
 
Couch DB in 15minutes
Couch DB in 15minutesCouch DB in 15minutes
Couch DB in 15minutesYohei Sasaki
 
RelaxCafe@CouchDB break.4
RelaxCafe@CouchDB break.4RelaxCafe@CouchDB break.4
RelaxCafe@CouchDB break.4Yohei Sasaki
 
CouchDB+OpenSocial - OSC 2009/Fall Tokyo (En)
CouchDB+OpenSocial - OSC 2009/Fall Tokyo (En)CouchDB+OpenSocial - OSC 2009/Fall Tokyo (En)
CouchDB+OpenSocial - OSC 2009/Fall Tokyo (En)Yohei Sasaki
 
CouchDB+OpenSocial - OSC 2009/Fall Tokyo
CouchDB+OpenSocial - OSC 2009/Fall TokyoCouchDB+OpenSocial - OSC 2009/Fall Tokyo
CouchDB+OpenSocial - OSC 2009/Fall TokyoYohei Sasaki
 
前回のまとめ
前回のまとめ前回のまとめ
前回のまとめYohei Sasaki
 
Finding Your Data with Views
Finding Your Data with ViewsFinding Your Data with Views
Finding Your Data with ViewsYohei Sasaki
 
Couch Db勉強会0623 by yssk22
Couch Db勉強会0623 by yssk22Couch Db勉強会0623 by yssk22
Couch Db勉強会0623 by yssk22Yohei Sasaki
 

More from Yohei Sasaki (18)

20120317 CloudFoundry #pyfes
20120317 CloudFoundry #pyfes20120317 CloudFoundry #pyfes
20120317 CloudFoundry #pyfes
 
CloudFoundry@home
CloudFoundry@homeCloudFoundry@home
CloudFoundry@home
 
MongoDB on CloudFoundry
MongoDB on CloudFoundryMongoDB on CloudFoundry
MongoDB on CloudFoundry
 
MongoDB on CloudFoundry
MongoDB on CloudFoundryMongoDB on CloudFoundry
MongoDB on CloudFoundry
 
membase
membasemembase
membase
 
CouchDB JP & BigCouch
CouchDB JP & BigCouchCouchDB JP & BigCouch
CouchDB JP & BigCouch
 
Bp study39 nodejs
Bp study39 nodejsBp study39 nodejs
Bp study39 nodejs
 
BPStudy32 CouchDB 再入門
BPStudy32 CouchDB 再入門BPStudy32 CouchDB 再入門
BPStudy32 CouchDB 再入門
 
CouchDB
CouchDBCouchDB
CouchDB
 
Couch DB in 15minutes
Couch DB in 15minutesCouch DB in 15minutes
Couch DB in 15minutes
 
RelaxCafe@CouchDB break.4
RelaxCafe@CouchDB break.4RelaxCafe@CouchDB break.4
RelaxCafe@CouchDB break.4
 
Media On Couch
Media On CouchMedia On Couch
Media On Couch
 
CouchDB+OpenSocial - OSC 2009/Fall Tokyo (En)
CouchDB+OpenSocial - OSC 2009/Fall Tokyo (En)CouchDB+OpenSocial - OSC 2009/Fall Tokyo (En)
CouchDB+OpenSocial - OSC 2009/Fall Tokyo (En)
 
CouchDB+OpenSocial - OSC 2009/Fall Tokyo
CouchDB+OpenSocial - OSC 2009/Fall TokyoCouchDB+OpenSocial - OSC 2009/Fall Tokyo
CouchDB+OpenSocial - OSC 2009/Fall Tokyo
 
前回のまとめ
前回のまとめ前回のまとめ
前回のまとめ
 
Finding Your Data with Views
Finding Your Data with ViewsFinding Your Data with Views
Finding Your Data with Views
 
Why CouchDB
Why CouchDBWhy CouchDB
Why CouchDB
 
Couch Db勉強会0623 by yssk22
Couch Db勉強会0623 by yssk22Couch Db勉強会0623 by yssk22
Couch Db勉強会0623 by yssk22
 

Couch Db.0.9.0.Pub