{"id":1314,"date":"2014-12-21T19:28:00","date_gmt":"2014-12-21T10:28:00","guid":{"rendered":"http:\/\/tech.akat.info\/?p=1314"},"modified":"2014-12-21T19:32:43","modified_gmt":"2014-12-21T10:32:43","slug":"couchdb","status":"publish","type":"post","link":"https:\/\/tech.akat.info\/?p=1314","title":{"rendered":"CouchDB"},"content":{"rendered":"<h1>\u6982\u8981<\/h1>\n<p>\uff20IT\u306ecouchDB\u8a18\u4e8b\u3092\u5229\u7528\u3057\u3066\u3001\u3044\u308d\u3044\u308d\u3084\u3063\u3066\u307f\u305f<br \/>\nhttp:\/\/www.atmarkit.co.jp\/ait\/articles\/0909\/04\/news105.html<\/p>\n<h1>CouchDB\u3068\u306f<\/h1>\n<p>\u30fb2009\u5e743\u6708\u306bApache Software Foudation\u306e\u6b63\u5f0f\u306a\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3068\u3057\u3066\u6700\u521d\u306e\u30ea\u30ea\u30fc\u30b9<br \/>\n\u30fb\u4e3b\u306bErlang\u3068\u3044\u3046\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3067\u5b9f\u88c5\u3055\u308c\u3066\u3044\u308b<br \/>\n\u30fbJSON\u5f62\u5f0f\u3092\u4ecb\u3057\u3066\u30c7\u30fc\u30bf\u306e\u5165\u51fa\u529b\u3092\u5b9f\u65bd<br \/>\n\u30fb\u5404\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u5bfe\u3057\u3066\u4e00\u610f\u306aURI\u3092\u5272\u308a\u5f53\u3066\u308b\u3002\u3064\u307e\u308a\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u64cd\u4f5c\u306bHTTP\u30e1\u30bd\u30c3\u30c9\u3092\u5229\u7528\u3067\u304d\u308b<br \/>\n\u30fb\u30c7\u30fc\u30bf\u3092\u30ea\u30d3\u30b8\u30e7\u30f3\u7ba1\u7406\u3057\u3066\u304a\u308aCompaction\u3092\u5b9f\u884c\u3059\u308b\u307e\u3067\u306f\u3001\u5c65\u6b74\u304c\u524a\u9664\u3055\u308c\u306a\u3044<br \/>\n\u30fb\u30ec\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u6a5f\u80fd\u304c\u6a19\u6e96\u3067\u7d44\u307f\u8fbc\u307e\u308c\u3066\u304a\u308a\u3001\u5229\u7528\u8005\u306e\u4efb\u610f\u306e\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u30ec\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3059\u308b<br \/>\n\u3000\u30ec\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306f\u3001\u6700\u65b0\u306e\u30ea\u30d3\u30b7\u30e7\u30f3\u306e\u307f\u304c\u5bfe\u8c61\u3068\u306a\u308b<br \/>\n\u3000\u3053\u306e\u6a5f\u80fd\u3092\u5229\u7528\u3057\u3066\u3001\u30aa\u30d5\u30e9\u30a4\u30f3\u3067CouchDB\u3092\u5229\u7528\u3057\u3066\u3001\u30aa\u30f3\u30e9\u30a4\u30f3\u306b\u306a\u308b\u3068\u30ec\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u540c\u671f\u3001\u3068\u3044\u3063\u305f\u52d5\u304d\u3082\u53ef\u80fd<br \/>\n\u30fbDesign Document\u3068\u3044\u3046\u7279\u5225\u306a\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u304c\u3042\u308a\u3001\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e\u691c\u7d22\u3084\u96c6\u8a08\u51e6\u7406\u3001\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e\u8868\u793a\u3092\u52d5\u7684\u306b\u51e6\u7406\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd<\/p>\n<h1>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h1>\n<pre class=\"brush: plain; title: \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb; notranslate\" title=\"\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\">\r\nroot@hostname:\/home\/shimizu# aptitude show couchdb\r\n\u30d1\u30c3\u30b1\u30fc\u30b8: couchdb\r\n\u72b6\u614b: \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u307e\u305b\u3093\r\n\u30d0\u30fc\u30b8\u30e7\u30f3: 1.2.0-5\r\n\u512a\u5148\u5ea6: \u4efb\u610f\r\n\u30bb\u30af\u30b7\u30e7\u30f3: misc\r\n\u30e1\u30f3\u30c6\u30ca: Laszlo Boszormenyi (GCS) &lt;gcs@debian.hu&gt;\r\n\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3: amd64\r\n\u5c55\u958b\u30b5\u30a4\u30ba: 2,713 k\r\n\u4f9d\u5b58: adduser, erlang-base (&gt;= 1:15.b.1-dfsg) | erlang-base-hipe (&gt;=\r\n        1:15.b.1-dfsg), libjs-jquery (&gt;= 1.4.2), libjs-jquery-form (&gt;= 2.36),\r\n        lsb-base, procps, erlang-crypto (&gt;= 1:15.b.1-dfsg), erlang-inets (&gt;=\r\n        1:15.b.1-dfsg), erlang-xmerl (&gt;= 1:15.b.1-dfsg), erlang-eunit (&gt;=\r\n        1:15.b.1-dfsg), erlang-os-mon (&gt;= 1:15.b.1-dfsg), erlang-ssl (&gt;=\r\n        1:15.b.1-dfsg), erlang-syntax-tools (&gt;= 1:15.b.1-dfsg), erlang-tools (&gt;=\r\n        1:15.b.1-dfsg), libc6 (&gt;= 2.4), libcurl3 (&gt;= 7.16.2), libgcc1 (&gt;=\r\n        1:4.1.1), libicu48 (&gt;= 4.8-1), libmozjs185-1.0 (&gt;= 1.8.5-1.0.0+dfsg),\r\n        libstdc++6 (&gt;= 4.4.0)\r\n\u8aac\u660e: REST \u3092\u6d3b\u7528\u3057\u305f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u6307\u5411\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\r\n Apache CouchDB \u306f\u5206\u6563\u578b\u3067\u3001\u8010\u6545\u969c\u6027\u304c\u3042\u308a\u3001\u30b9\u30ad\u30fc\u30de\u30d5\u30ea\u30fc\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u6307\u5411\r\n \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3067\u3001REST \u3092\u6d3b\u7528\u3057\u305f HTTP\/JSON API \u3067\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u3059\u3002\r\n \u305d\u306e\u307b\u304b\u306e\u7279\u5fb4\u3068\u3057\u3066\u306f\u3001\u30ed\u30d0\u30b9\u30c8\u6027\u3001\u53cc\u65b9\u5411\u885d\u7a81\u3092\u691c\u77e5\u3057\u3066\u89e3\u6c7a\u3067\u304d\u308b\u5dee\u5206\u8907\u88fd\r\n \u6a5f\u80fd\u304c\u3042\u308a\u3001\u307e\u305f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30d3\u30e5\u30fc\u5b9a\u7fa9\u8a00\u8a9e\u3067\u3042\u308b JavaScript \u3092\u7528\u3044\u3066\u30c6\u30fc\r\n \u30d6\u30eb\u6307\u5411\u306e\u30d3\u30e5\u30fc\u30a8\u30f3\u30b8\u30f3\u3092\u4f7f\u3063\u305f\u63a2\u7d22\u304a\u3088\u3073\u7d22\u5f15\u4f5c\u6210\u304c\u53ef\u80fd\u3067\u3059\u3002\r\n\r\n CouchDB \u306f Erlang \u3067\u66f8\u304b\u308c\u3066\u3044\u307e\u3059\u304c\u3001HTTP \u30ea\u30af\u30a8\u30b9\u30c8\u3092\u767a\u884c\u3067\u304d\u308b\u74b0\u5883\u306a\u3089\u3069\r\n \u3053\u304b\u3089\u3067\u3082\u7c21\u5358\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3044\u308d\u3044\u308d\u306a\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3084\r\n \u74b0\u5883\u306b\u304a\u3044\u3066\u3001\u3088\u308a\u7c21\u5358\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u306e\u305f\u304f\u3055\u3093\u306e\u30b5\u30fc\u30c9\u30d1\u30fc\r\n \u30c6\u30a3\u88fd\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30e9\u30a4\u30d6\u30e9\u30ea\u304c\u3042\u308a\u307e\u3059\u3002\r\n\u30db\u30fc\u30e0\u30da\u30fc\u30b8: http:\/\/couchdb.apache.org\/\r\n\r\nroot@hostname:\/home\/shimizu# aptitude install couchdb\r\n\u4ee5\u4e0b\u306e\u65b0\u898f\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u307e\u3059:\r\n  couchdb erlang-asn1{a} erlang-base{a} erlang-crypto{a} erlang-eunit{a} erlang-inets{a} erlang-mnesia{a}\r\n  erlang-os-mon{a} erlang-public-key{a} erlang-runtime-tools{a} erlang-snmp{a} erlang-ssl{a}\r\n  erlang-syntax-tools{a} erlang-tools{a} erlang-webtool{a} erlang-xmerl{a} libjs-jquery-form{a}\r\n  libmozjs185-1.0{a} libsctp1{a} lksctp-tools{a}\r\n\u66f4\u65b0: 0 \u500b\u3001\u65b0\u898f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb: 20 \u500b\u3001\u524a\u9664: 0 \u500b\u3001\u4fdd\u7559: 2 \u500b\u3002\r\n16.2 M \u30d0\u30a4\u30c8\u306e\u30a2\u30fc\u30ab\u30a4\u30d6\u3092\u53d6\u5f97\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u5c55\u958b\u5f8c\u306b 31.1 M \u30d0\u30a4\u30c8\u306e\u30c7\u30a3\u30b9\u30af\u9818\u57df\u304c\u65b0\u305f\u306b\u6d88\u8cbb\u3055\u308c\u307e\u3059\u3002\r\n\u5148\u306b\u9032\u307f\u307e\u3059\u304b? &#x5B;Y\/n\/?] y\r\n...\r\ncouchdb (1.2.0-5) \u3092\u8a2d\u5b9a\u3057\u3066\u3044\u307e\u3059 ...\r\n&#x5B; ok ] Starting database server: couchdb.\r\nlibsctp1 (1.0.11+dfsg-2) \u3092\u8a2d\u5b9a\u3057\u3066\u3044\u307e\u3059 ...\r\nlksctp-tools (1.0.11+dfsg-2) \u3092\u8a2d\u5b9a\u3057\u3066\u3044\u307e\u3059 ...\r\n\r\nroot@hostname:\/home\/shimizu# ps afx | grep &quot;&#x5B;c]ouch&quot;\r\n29221 ?        S      0:00 \/bin\/sh -e \/usr\/bin\/couchdb -a \/etc\/couchdb\/default.ini -a \/etc\/couchdb\/local.ini -b -r 5 -p \/var\/run\/couchdb\/couchdb.pid -o \/dev\/null -e \/dev\/null -R\r\n29243 ?        S      0:00  \\_ \/bin\/sh -e \/usr\/bin\/couchdb -a \/etc\/couchdb\/default.ini -a \/etc\/couchdb\/local.ini -b -r 5 -p \/var\/run\/couchdb\/couchdb.pid -o \/dev\/null -e \/dev\/null -R\r\n29244 ?        Sl     0:00      \\_ \/usr\/lib\/erlang\/erts-5.9.1\/bin\/beam.smp -Bd -K true -A 4 -- -root \/usr\/lib\/erlang -progname erl -- -home \/var\/lib\/couchdb -- -noshell -noinput -os_mon start_memsup false start_cpu_sup false disk_space_check_interval 1 disk_almost_full_threshold 1 -sasl errlog_type error -couch_ini \/etc\/couchdb\/default.ini \/etc\/couchdb\/local.ini \/etc\/couchdb\/default.ini \/etc\/couchdb\/local.ini -s couch -pidfile \/var\/run\/couchdb\/couchdb.pid -heart\r\n\r\nroot@hostname:\/home\/shimizu# vi \/etc\/couchdb\/default.ini\r\n=====\r\n&#x5B;httpd]\r\nport = 5984\r\nbind_address = 0.0.0.0\r\n=====\r\nroot@hostname:\/home\/shimizu# \/etc\/init.d\/couchdb restart\r\n&#x5B; ok ] Restarting database server: couchdb.\r\n<\/pre>\n<p>\u5916\u90e8\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068<br \/>\n<a href=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2014\/12\/2014-12-20_213921.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2014\/12\/2014-12-20_213921.png\" alt=\"2014-12-20_213921\" width=\"405\" height=\"91\" class=\"alignnone size-full wp-image-1315\" \/><\/a><\/p>\n<p>CouchDB\u306e\u7ba1\u7406\u30c4\u30fc\u30eb\u3067\u3042\u308bFuton\u30e6\u30fc\u30c6\u30a3\u30ea\u30c6\u30a3\u3092\u5229\u7528\u3059\u308b<br \/>\n<a href=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2014\/12\/2014-12-20_213944.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2014\/12\/2014-12-20_213944.png\" alt=\"2014-12-20_213944\" width=\"1365\" height=\"468\" class=\"alignnone size-full wp-image-1316\" \/><\/a><\/p>\n<p>test_suite_foobar\u5185\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u95b2\u89a7\u3059\u308b<br \/>\n<a href=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2014\/12\/2014-12-20_214850.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2014\/12\/2014-12-20_214850.png\" alt=\"2014-12-20_214850\" width=\"1333\" height=\"343\" class=\"alignnone size-full wp-image-1317\" \/><\/a><\/p>\n<p>test_suite_foobar\u5185\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306f\u4ee5\u4e0bURL\u3067\u30a2\u30af\u30bb\u30b9\u53ef\u80fd<br \/>\nhttp:\/\/49.212.204.46:5984\/test_suite_foobar\/doc1<br \/>\n<a href=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2014\/12\/2014-12-20_215310.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2014\/12\/2014-12-20_215310.png\" alt=\"2014-12-20_215310\" width=\"581\" height=\"131\" class=\"alignnone size-full wp-image-1318\" \/><\/a><\/p>\n<h1>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u64cd\u4f5c<\/h1>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nroot@hostname:\/home\/shimizu# mkdir couchdb\r\nroot@hostname:\/home\/shimizu# cd couchdb\/\r\nroot@hostname:\/home\/shimizu\/couchdb# git clone git:\/\/github.com\/z-ohnami\/cocktail-sample.git\r\nCloning into 'cocktail-sample'...\r\nremote: Counting objects: 27, done.\r\nremote: Total 27 (delta 0), reused 0 (delta 0)\r\nReceiving objects: 100% (27\/27), 28.83 KiB, done.\r\nResolving deltas: 100% (6\/6), done.\r\nroot@hostname:\/home\/shimizu\/couchdb# cd cocktail-sample\/\r\nroot@hostname:\/home\/shimizu\/couchdb\/cocktail-sample# .\/upload-all.sh 127.0.0.1\r\n{&quot;ok&quot;:true}\r\n{&quot;ok&quot;:true,&quot;id&quot;:&quot;matini&quot;,&quot;rev&quot;:&quot;1-f58be22e6c517a3740432c096331a30f&quot;}\r\n{&quot;error&quot;:&quot;bad_content_type&quot;,&quot;reason&quot;:&quot;Content-Type must be application\/json&quot;}\r\n{&quot;error&quot;:&quot;bad_content_type&quot;,&quot;reason&quot;:&quot;Content-Type must be application\/json&quot;}\r\n{&quot;ok&quot;:true,&quot;id&quot;:&quot;_design\/d01&quot;,&quot;rev&quot;:&quot;1-ed539ac0b127da44904226819196fbf3&quot;}\r\n{&quot;ok&quot;:true,&quot;id&quot;:&quot;_design\/d02&quot;,&quot;rev&quot;:&quot;1-a48d76a64eaeaec52305bf3452f1e79b&quot;}\r\n{&quot;ok&quot;:true,&quot;id&quot;:&quot;_design\/d03&quot;,&quot;rev&quot;:&quot;1-9a3317be70ecc076e136f4d17c6fbaa0&quot;}\r\n{&quot;ok&quot;:true,&quot;id&quot;:&quot;_design\/d04&quot;,&quot;rev&quot;:&quot;1-17df994bc036dc89be2e14472effb4ae&quot;}\r\nfinished ...,be relaxed !!\r\n\r\n### \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f5c\u6210\u3059\u308b ###\r\nroot@hostname:\/home\/shimizu\/couchdb\/cocktail-sample# curl -X PUT 'http:\/\/127.0.0.1:5984\/test'\r\n{&quot;ok&quot;:true}\r\nroot@hostname:\/home\/shimizu\/couchdb\/cocktail-sample# curl -X GET 'http:\/\/127.0.0.1:5984\/test'\r\n{&quot;db_name&quot;:&quot;test&quot;,&quot;doc_count&quot;:0,&quot;doc_del_count&quot;:0,&quot;update_seq&quot;:0,&quot;purge_seq&quot;:0,&quot;compact_running&quot;:false,&quot;disk_size&quot;:79,&quot;data_size&quot;:0,&quot;instance_start_time&quot;:&quot;1419082712784379&quot;,&quot;disk_format_version&quot;:6,&quot;committed_update_seq&quot;:0}\r\n\r\n### \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u4e00\u89a7\u3092JSON\u5f62\u5f0f\u3067\u53d6\u5f97\u3059\u308b ###\r\nroot@hostname:\/home\/shimizu\/couchdb\/cocktail-sample# curl -X GET 'http:\/\/127.0.0.1:5984\/_all_dbs'\r\n&#x5B;&quot;_replicator&quot;,&quot;_users&quot;,&quot;cocktail-book&quot;,&quot;test&quot;,&quot;test_suite_db&quot;,&quot;test_suite_db\/with_slashes&quot;,&quot;test_suite_db_a&quot;,&quot;test_suite_db_b&quot;,&quot;test_suite_db_c&quot;,&quot;test_suite_foobar&quot;,&quot;test_suite_reports&quot;,&quot;test_suite_users&quot;]\r\n\r\n### \u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u767b\u9332\u3059\u308b(POST\u3060\u3068id\u304cuuid\u3067\u81ea\u52d5\u63a1\u756a\u3055\u308c\u308b) ###\r\nroot@hostname:\/home\/shimizu\/couchdb\/cocktail-sample# curl -X PUT  -d '{&quot;name&quot;:&quot;mimosa&quot;,&quot;proof&quot;:32}' 'http:\/\/127.0.0.1:5984\/cocktail-book\/mimosa'\r\n{&quot;ok&quot;:true,&quot;id&quot;:&quot;mimosa&quot;,&quot;rev&quot;:&quot;1-3c1c87c4524329789538e73bce534f61&quot;}\r\nroot@hostname:\/home\/shimizu\/couchdb\/cocktail-sample# curl -X GET http:\/\/127.0.0.1:5984\/cocktail-book\/mimosa\r\n{&quot;_id&quot;:&quot;mimosa&quot;,&quot;_rev&quot;:&quot;1-3c1c87c4524329789538e73bce534f61&quot;,&quot;name&quot;:&quot;mimosa&quot;,&quot;proof&quot;:32}\r\n\r\n### \u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u66f4\u65b0\u3059\u308b\u3002\u90e8\u5206\u66f4\u65b0\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u306a\u3044\u3002\u30ea\u30d3\u30b8\u30e7\u30f3\u7ba1\u7406\u3055\u308c\u308b ###\r\nroot@hostname:\/home\/shimizu\/couchdb\/cocktail-sample# cat document\/mimosa.txt\r\n{\r\n&quot;_rev&quot;:&quot;1-3c1c87c4524329789538e73bce534f61&quot;,\r\n&quot;name&quot;:&quot;\u30df\u30e2\u30b6&quot;,\r\n&quot;proof&quot;:32,\r\n&quot;howto&quot;:&quot;\u30b9\u30c6\u30a2&quot;,\r\n&quot;base&quot;:&quot;\u30b7\u30e3\u30f3\u30d1\u30f3&quot;,\r\n&quot;recipe&quot;:{\r\n    &quot;\u30b7\u30e3\u30f3\u30d1\u30f3&quot;:&quot;60ml&quot;,\r\n    &quot;\u30aa\u30ec\u30f3\u30b8\u30b8\u30e5\u30fc\u30b9&quot;:&quot;60ml&quot;\r\n  },\r\n&quot;situation&quot;:&#x5B;&quot;\u98df\u524d&quot;,&quot;\u98df\u5f8c&quot;,&quot;007&quot;,&quot;\u30ca\u30a4\u30c8\u30ad\u30e3\u30c3\u30d7&quot;,&quot;\u30c7\u30b6\u30fc\u30c8&quot;]\r\n}\r\n\r\nroot@hostname:\/home\/shimizu\/couchdb\/cocktail-sample# curl -X PUT -d @'.\/document\/mimosa.txt' 'http:\/\/127.0.0.1:5984\/cocktail-book\/mimosa'\r\n{&quot;ok&quot;:true,&quot;id&quot;:&quot;mimosa&quot;,&quot;rev&quot;:&quot;2-a8188c791fed7f4f96e82f71c77a66f3&quot;}\r\nroot@hostname:\/home\/shimizu\/couchdb\/cocktail-sample# curl -X GET http:\/\/127.0.0.1:5984\/cocktail-book\/mimosa\r\n{&quot;_id&quot;:&quot;mimosa&quot;,&quot;_rev&quot;:&quot;2-a8188c791fed7f4f96e82f71c77a66f3&quot;,&quot;name&quot;:&quot;\u30df\u30e2\u30b6&quot;,&quot;proof&quot;:32,&quot;howto&quot;:&quot;\u30b9\u30c6\u30a2&quot;,&quot;base&quot;:&quot;\u30b7\u30e3\u30f3\u30d1\u30f3&quot;,&quot;recipe&quot;:{&quot;\u30b7\u30e3\u30f3\u30d1\u30f3&quot;:&quot;60ml&quot;,&quot;\u30aa\u30ec\u30f3\u30b8\u30b8\u30e5\u30fc\u30b9&quot;:&quot;60ml&quot;},&quot;situation&quot;:&#x5B;&quot;\u98df\u524d&quot;,&quot;\u98df\u5f8c&quot;,&quot;007&quot;,&quot;\u30ca\u30a4\u30c8\u30ad\u30e3\u30c3\u30d7&quot;,&quot;\u30c7\u30b6\u30fc\u30c8&quot;]}\r\n\r\n### \u691c\u7d22\u3059\u308b\u3002&quot;_all_docs&quot;API\u3067key\u306b\u6307\u5b9a\u3067\u304d\u308b\u306e\u306f&quot;_id&quot;\u306e\u307f ###\r\nroot@hostname:\/home\/shimizu\/couchdb\/cocktail-sample# curl -X GET 'http:\/\/127.0.0.1:5984\/cocktail-book\/_all_docs?startkey=&quot;ma&quot;'\r\n{&quot;total_rows&quot;:6,&quot;offset&quot;:4,&quot;rows&quot;:&#x5B;\r\n{&quot;id&quot;:&quot;matini&quot;,&quot;key&quot;:&quot;matini&quot;,&quot;value&quot;:{&quot;rev&quot;:&quot;1-f58be22e6c517a3740432c096331a30f&quot;}},\r\n{&quot;id&quot;:&quot;mimosa&quot;,&quot;key&quot;:&quot;mimosa&quot;,&quot;value&quot;:{&quot;rev&quot;:&quot;2-a8188c791fed7f4f96e82f71c77a66f3&quot;}}\r\n]}\r\n\r\n### \u4e00\u89a7\u53d6\u5f97\u3059\u308b ###\r\nroot@hostname:\/etc\/couchdb# curl -X GET 'http:\/\/127.0.0.1:5984\/cocktail-book\/_all_docs'\r\n{&quot;total_rows&quot;:6,&quot;offset&quot;:0,&quot;rows&quot;:&#x5B;\r\n{&quot;id&quot;:&quot;_design\/d01&quot;,&quot;key&quot;:&quot;_design\/d01&quot;,&quot;value&quot;:{&quot;rev&quot;:&quot;3-0f090673dd5b44d4d4698c98575260b5&quot;}},\r\n{&quot;id&quot;:&quot;_design\/d02&quot;,&quot;key&quot;:&quot;_design\/d02&quot;,&quot;value&quot;:{&quot;rev&quot;:&quot;1-a48d76a64eaeaec52305bf3452f1e79b&quot;}},\r\n{&quot;id&quot;:&quot;_design\/d03&quot;,&quot;key&quot;:&quot;_design\/d03&quot;,&quot;value&quot;:{&quot;rev&quot;:&quot;1-9a3317be70ecc076e136f4d17c6fbaa0&quot;}},\r\n{&quot;id&quot;:&quot;_design\/d04&quot;,&quot;key&quot;:&quot;_design\/d04&quot;,&quot;value&quot;:{&quot;rev&quot;:&quot;3-088c86f5c242e9b5f3ca7cb14c99910b&quot;}},\r\n{&quot;id&quot;:&quot;matini&quot;,&quot;key&quot;:&quot;matini&quot;,&quot;value&quot;:{&quot;rev&quot;:&quot;1-f58be22e6c517a3740432c096331a30f&quot;}},\r\n{&quot;id&quot;:&quot;mimosa&quot;,&quot;key&quot;:&quot;mimosa&quot;,&quot;value&quot;:{&quot;rev&quot;:&quot;2-a8188c791fed7f4f96e82f71c77a66f3&quot;}}\r\n]}\r\n<\/pre>\n<h1>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u64cd\u4f5c-Design Document<\/h1>\n<h2>view<\/h2>\n<p>\u7279\u5b9a\u306e\u6761\u4ef6\u306b\u5408\u81f4\u3059\u308b\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e\u691c\u7d22\u3084\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e\u96c6\u8a08\u51e6\u7406\u304c\u3067\u304d\u308b<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nroot@hostname:\/home\/shimizu\/couchdb\/cocktail-sample# cat .\/design\/d01.txt\r\n{\r\n  &quot;language&quot;: &quot;javascript&quot;,\r\n  &quot;views&quot;: {\r\n    &quot;gin-by-proof&quot; : {\r\n      &quot;map&quot;: &quot;function(doc) {\r\n        if (doc.proof &amp;&amp; doc.base == \\&quot;\u30b8\u30f3\\&quot;) {\r\n            emit(doc.proof, doc.name);\r\n          }}&quot;\r\n       },\r\n   &quot;all-by-base&quot; : {\r\n      &quot;map&quot;: &quot;function(doc) {\r\n        if (doc.name) {\r\n            emit(doc.base, doc.name);\r\n          }}&quot;\r\n       }\r\n   }\r\n}\r\n\r\nroot@hostname:\/home\/shimizu\/couchdb\/cocktail-sample# curl -X PUT -H'Content-Type: application\/json' -d @'.\/design\/d01.txt' 'http:\/\/127.0.0.1:5984\/cocktail-book\/_design\/d01'\r\n{&quot;ok&quot;:true,&quot;id&quot;:&quot;_design\/d01&quot;,&quot;rev&quot;:&quot;3-0f090673dd5b44d4d4698c98575260b5&quot;}\r\nroot@hostname:\/home\/shimizu\/couchdb\/cocktail-sample# curl -X GET 'http:\/\/127.0.0.1:5984\/cocktail-book\/_design\/d01\/_view\/gin-by-proof?descending=true'\r\n{&quot;total_rows&quot;:1,&quot;offset&quot;:0,&quot;rows&quot;:&#x5B;\r\n{&quot;id&quot;:&quot;matini&quot;,&quot;key&quot;:35,&quot;value&quot;:&quot;\u30de\u30c6\u30a3\u30fc\u30cb&quot;}\r\n]}\r\n<\/pre>\n<h2>show , list<\/h2>\n<p>JSON\u5f62\u5f0f\u306e\u30c7\u30fc\u30bf\u3092\u4efb\u610f\u306e\u66f8\u5f0f\u3067\u51fa\u529b\u3067\u304d\u308b<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nroot@hostname:\/home\/shimizu\/couchdb\/cocktail-sample# cat design\/d03.txt\r\n{\r\n  &quot;language&quot;: &quot;javascript&quot;,\r\n  &quot;views&quot;: {\r\n    &quot;gin-by-proof&quot; : {\r\n      &quot;map&quot;: &quot;function(doc) {\r\n        if (doc.proof &amp;&amp; doc.base == \\&quot;\u30b8\u30f3\\&quot;) {\r\n            emit(doc.proof, doc.name);\r\n          }}&quot;\r\n       }\r\n   },\r\n  &quot;shows&quot;: {\r\n     &quot;show-detail&quot;: &quot;(function (doc, req) {\r\n        if (doc) {\r\n           var str;\r\n           str = \\&quot;&lt;h2&gt;\\&quot; + doc.name + \\&quot;&lt;\/h2&gt;&lt;ul&gt;\\&quot;;\r\n           str = str + \\&quot;&lt;li&gt;\u5ea6\u6570:\\&quot; + doc.proof + \\&quot;&lt;\/li&gt;\\&quot;;\r\n           str = str + \\&quot;&lt;li&gt;\u30d9\u30fc\u30b9\u306e\u304a\u9152:\\&quot; + doc.base + \\&quot;&lt;\/li&gt;\\&quot;;\r\n           str = str + \\&quot;&lt;li&gt;\u4f5c\u308a\u65b9:\\&quot; + doc.howto + \\&quot;&lt;\/li&gt;\\&quot;;\r\n\r\n           str = str + \\&quot;&lt;li&gt;\u30ec\u30b7\u30d4:&lt;ul&gt;\\&quot;;\r\n           for(var r in doc.recipe) {\r\n              str = str + \\&quot;&lt;li&gt;\\&quot; + r + \\&quot;:\\&quot; +doc.recipe&#x5B;r] + \\&quot;&lt;\/li&gt;\\&quot;;\r\n           }\r\n           str = str + \\&quot;&lt;\/ul&gt;&lt;\/li&gt;\\&quot;;\r\n\r\n           str = str + \\&quot;&lt;li&gt;\u30b7\u30c1\u30e5\u30a8\u30fc\u30b7\u30e7\u30f3:\\&quot;;\r\n           for(var i in doc.situation) {\r\n              if (i &gt; 0) str = str + \\&quot;,\\&quot;;\r\n              str = str + doc.situation&#x5B;i];\r\n           }\r\n           str = str + \\&quot;&lt;\/li&gt;&lt;\/ul&gt;\\&quot;;\r\n\r\n           if (doc._attachments) {\r\n\r\n              str = str + \\&quot;&lt;img src=\\\\\\&quot;..\/..\/..\/..\/\\&quot; + doc._id + \\&quot;\/\\&quot; + doc._id + \\&quot;.jpg\\\\\\&quot;&gt;\\&quot;;\r\n\r\n           }\r\n\r\n           return str;\r\n\r\n      } else {\r\n        if (req.docId) {\r\n           return \\&quot;Undefined Document...\\&quot;;\r\n        } else {\r\n           return \\&quot;docId is empty...\\&quot;;\r\n        }\r\n      }\r\n    })&quot;\r\n  }\r\n}\r\n\r\nroot@hostname:\/home\/shimizu\/couchdb\/cocktail-sample# curl -X PUT -H'Content-Type: application\/json' -d @'.\/design\/d04.txt' 'http:\/\/127.0.0.1:5984\/cocktail-book\/_design\/d04'\r\n{&quot;ok&quot;:true,&quot;id&quot;:&quot;_design\/d04&quot;,&quot;rev&quot;:&quot;3-088c86f5c242e9b5f3ca7cb14c99910b&quot;}\r\n<\/pre>\n<p>http:\/\/49.212.204.46:5984\/cocktail-book\/_design\/d03\/_show\/show-detail\/mimosa<br \/>\n\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068<br \/>\n<a href=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2014\/12\/2014-12-21_002551.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2014\/12\/2014-12-21_002551.png\" alt=\"2014-12-21_002551\" width=\"783\" height=\"261\" class=\"alignnone size-full wp-image-1319\" \/><\/a><\/p>\n<h1>\u30b9\u30b1\u30fc\u30eb\u30a2\u30a6\u30c8<\/h1>\n<p>CouchDB\u3092\u30ce\u30fc\u30c9\u3068\u3057\u3066\u767b\u9332\u3059\u308b<br \/>\ndumbproxy\u3068\u3044\u3046Nginx\u3092\u3082\u3068\u306b\u3057\u305f\u30ea\u30d0\u30fc\u30b9\u30d7\u30ed\u30ad\u30b7\u304c\u53d7\u3051\u3066\u3001\u5bfe\u8c61\u30ce\u30fc\u30c9\u306b\u632f\u308a\u5206\u3051\u308b<br \/>\n\u3059\u3079\u3066\u306e\u30ce\u30fc\u30c9\u304c\u5bfe\u8c61\u306b\u306a\u308b\u51e6\u7406\u306fsmartproxy\u3068\u3044\u3046Twisted\u3092\u5229\u7528\u3057\u305f\u30ea\u30d0\u30fc\u30b9\u30d7\u30ed\u30ad\u30b7\u306b\u51e6\u7406\u304c\u5f15\u304d\u7d99\u304c\u308c\u308b<br \/>\n\u30d1\u30c3\u30c1\u3092\u5f53\u3066\u306a\u3044\u3068CouchDB\u3092\u30ce\u30fc\u30c9\u3068\u3057\u3066\u767b\u9332\u3067\u304d\u306a\u3044\u70b9\u304c\u904b\u7528\u9762\u3068\u3057\u3066\u306e\u30cd\u30c3\u30af<br \/>\n<a href=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2014\/12\/2014-12-21_191646.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2014\/12\/2014-12-21_191646.png\" alt=\"2014-12-21_191646\" width=\"668\" height=\"324\" class=\"alignnone size-full wp-image-1320\" \/><\/a><\/p>\n<h1>\u53c2\u8003URL<\/h1>\n<p>\u201c\u52d5\u7269\u56f3\u9451\u201d\u3067\u77e5\u308bCouchDB\u306e\u7279\u5fb4<br \/>\nhttp:\/\/www.atmarkit.co.jp\/ait\/articles\/0909\/04\/news105.html<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8981 \uff20IT\u306ecouchDB\u8a18\u4e8b\u3092\u5229\u7528\u3057\u3066\u3001\u3044\u308d\u3044\u308d\u3084\u3063\u3066\u307f\u305f http:\/\/www.atmarkit.co.jp\/ait\/articles\/0909\/04\/news105.html CouchDB\u3068\u306f \u30fb2009\u5e743\u6708 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[7],"tags":[49],"_links":{"self":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts\/1314"}],"collection":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1314"}],"version-history":[{"count":4,"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts\/1314\/revisions"}],"predecessor-version":[{"id":1324,"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts\/1314\/revisions\/1324"}],"wp:attachment":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1314"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1314"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1314"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}