Weitere ähnliche Inhalte Ähnlich wie Couch Db.0.9.0.Pub (20) Mehr von Yohei Sasaki (18) Couch Db.0.9.0.Pub5. {
quot;_idquot; : quot;文書1quot;
quot;_revquot; : quot;リビジョンquot;
quot;titlequot; : quot;CouchDBについてquot;
quot;Contentquot; : quot;いろいろquot;
}
15. 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.
17. Show and list functions
for rendering documents
and views as developer
controlled content-types.
29. {
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;
}
30. GET
DB デザインドキュメントのID
/my_blog/_design/test/_show/
display/2009_04_20_1
shows のキー レンダリングするドキュメントのID
37. {
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;
}
}
38. 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;
};
}
})
44. 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;);
45. 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;
});
48. 0.9.0 新機能!
•Show and list functions
for rendering documents
and views as developer
controlled content-types.
58. • 公式
▫ 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 が記述するすべてのコンテンツは個人の意見
であり、勤務先の組織とは一切無関係のものです。