[Couchdb Wiki] Update of "How to contribute (for Non-Committers)" by LukeVenediger
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by LukeVenediger: http://wiki.apache.org/couchdb/How_to_contribute_%28for_Non-Committers%29 The comment on the change is: Added a link to the coding standards -- [[Anchor(step2)]] == Step 2: Go forth and code! == + * Take a look at the recommended coding standards here: http://couchdb.apache.org/community/standards.html * Before starting, make sure that your local copy is up to the latest version * For those using the command-line subversion tools, run this before starting: {{{
[Couchdb Wiki] Update of "How to contribute (for Non-Committers)" by NoahSlater
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by NoahSlater: http://wiki.apache.org/couchdb/How_to_contribute_%28for_Non-Committers%29 -- - Thanks for your interest in growing Couchdb! This page will explain the process of submitting code to fix issues or add features. + Thanks for your interest in growing CouchDB! This page will explain the process of submitting code to fix issues or add features. In this document: * [#pre Prerequisites] @@ -13, +13 @@ == Prerequisites == Ensure that you've * Installed from source: ["Installing from source"] - * Got your system running in Dev mode: ["Running Couchdb in Dev Mode"] + * Got your system running in Dev mode: ["Running CouchDB in Dev Mode"] [[Anchor(step1)]] == Step 1: See if your bug/feature exists in JIRA == - * JIRA is the issue tracker that Couchdb uses to track items of work. + * JIRA is the issue tracker that CouchDB uses to track items of work. * Visit https://issues.apache.org/jira/browse/COUCHDB to see if your issue already exists. * If it doesn't, you can open one by * Registering for a JIRA account here: https://issues.apache.org/jira/secure/Signup!default.jspa @@ -57, +57 @@ [[Anchor(questions)]] == Asking Questions And Getting Feedback == - You can contact the couchdb developers to ask questions and propose ideas by: + You can contact the CouchDB developers to ask questions and propose ideas by: * Sending a mail to the Dev mailing list: http://wiki.apache.org/couchdb/Mailing_lists or, * Chatting on IRC: #couchdb on Freenode (irc.freenode.net)
[Couchdb Wiki] Update of "CouchDB in the wild" by JanLehnardt
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by JanLehnardt: http://wiki.apache.org/couchdb/CouchDB_in_the_wild The comment on the change is: add case study by Nick G. -- * [http://www.friendpaste.com/ Friendpaste], a pastebin by Enki Multimedia * [http://www.cmlenz.net/ Christopher Lenz's Weblog] * [http://scratchpad.cmlenz.net/ Scratch pad], by Christopher Lenz - * [http://www.facebook.com/apps/application.php?id=2359644980 I Play WoW], a Facebook application by Nick Gerakines + * [http://www.facebook.com/apps/application.php?id=2359644980 I Play WoW], a Facebook application by Nick Gerakines. [http://blog.socklabs.com/2008/12/24/iplaywow_monthly_actives.html Case Study] * [http://www.moostrax.com MoosTrax], Web Based GPS Tracking * [http://peasized.net/ Pea Sized], a simple band web site * [http://iwantmyname.com/ iWantMyName], an easy to use domain registrar (finally)
[Couchdb Wiki] Trivial Update of "CouchDB in the wild" by paul jobs
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by paul jobs: http://wiki.apache.org/couchdb/CouchDB_in_the_wild -- * [http://github.com/jtulloch/scanty/tree/master Scanty on the Couch], a port of Adam Wiggins' Scanty blog software == Websites == - + * [http://www.teenwag.com/ Teenwag], a Teen Social network + * [http://www.youfindr.com/ Youfindr], a Social search engine * [http://www.wego.com/ Wego], a travel search website * [http://www.couch.it/ Couchit], minimal site creator * [http://www.friendpaste.com/ Friendpaste], a pastebin by Enki Multimedia @@ -25, +26 @@ * [http://iwantmyname.com/ iWantMyName], an easy to use domain registrar (finally) * [http://coravy.com/ coravy. website], corporate website using a non-cms build with CouchDB. + == Facebook Applications == + * [http://apps.facebook.com/ukissme/ Will you Kissme], Dating game + * [http://apps.facebook.com/getlucky/ Horoscope], Horoscopes + + == Internal Use == * [http://cybernetics.hudora.biz/ HUDORA] is using it for an internal Track & Trace application [http://blogs.23.nu/c0re/2008/12/building-a-track-and-trace-application-with-couchdb/ more].
[Couchdb Wiki] Update of "View Snippets" by ChrisAnderson
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by ChrisAnderson: http://wiki.apache.org/couchdb/View_Snippets The comment on the change is: added super basic map view -- This page collects code snippets to be used in your ["Views"]. They are mainly ment to help getting your head arround the map/reduce approach to databases. Keep in mind that the the Futon Web-Client silently adds group=true to your views. + + == Get docs with a particular user id + + {{{ + map: function(doc) { + if (doc.user_id) emit(doc.user_id, null) + } + }}} + + Then query with key=USER_ID to get all the rows that match that user. == Get all documents which have an attatchment ==
[Couchdb Wiki] Trivial Update of "View Snippets" by ChrisAnderson
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by ChrisAnderson: http://wiki.apache.org/couchdb/View_Snippets The comment on the change is: formatting -- This page collects code snippets to be used in your ["Views"]. They are mainly ment to help getting your head arround the map/reduce approach to databases. Keep in mind that the the Futon Web-Client silently adds group=true to your views. - == Get docs with a particular user id + == Get docs with a particular user id == {{{ map: function(doc) {
[Couchdb Wiki] Trivial Update of "View Snippets" by JanLehnardt
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by JanLehnardt: http://wiki.apache.org/couchdb/View_Snippets The comment on the change is: best practices -- {{{ map: function(doc) { + if (doc.user_id) { - if (doc.user_id) emit(doc.user_id, null) + emit(doc.user_id, null); + } } }}}
[Couchdb Wiki] Update of "Installing on Fedora10" by BryanClark
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by BryanClark: http://wiki.apache.org/couchdb/Installing_on_Fedora10 The comment on the change is: correcting the svn URL, removing incubator -- The code can be gotten from subversion using {{{ - $ svn checkout http://svn.apache.org/repos/asf/incubator/couchdb/trunk couchdb + $ svn checkout http://svn.apache.org/repos/asf/couchdb/trunk couchdb $ cd couchdb $ ./bootstrap $ ./configure
[Couchdb Wiki] Update of "ExternalProcesses" by JeffHinrichs
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by JeffHinrichs: http://wiki.apache.org/couchdb/ExternalProcesses The comment on the change is: added the modification to httpd_db_handlers section and ammended the text -- == Configuration == - Adding external processes is as easy as pie. Simply place key=command pairs in the ''[external]'' section of your ''local.ini'' like: + Adding external processes is as easy as pie. Simply place key=command pairs in the ''[external]'' section of your ''local.ini'' and then map those handlers in the ''[httpd_db_handlers]'' section, like: {{{ ;Including [log] and [update_notification] for context @@ -71, +71 @@ [external] test = /usr/local/src/couchdb/test.py + [httpd_db_handlers] + _test = {couch_httpd_external, handle_external_req, <<"test">>} + [update_notification] ;unique notifier name=/full/path/to/exe -with "cmd line arg" }}} @@ -78, +81 @@ This configuration will make the ''/usr/local/src/couchdb/test.py'' responsible for handling requests from the url: {{{ - http://127.0.0.1:5984/${dbname}/_external/test + http://127.0.0.1:5984/${dbname}/_test }}} == Example External Process ==
[Couchdb Wiki] Update of "Installing on RHEL5" by CarlB yström
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by CarlByström: http://wiki.apache.org/couchdb/Installing_on_RHEL5 The comment on the change is: Added --with-erlang include for configure -- svn checkout http://svn.apache.org/repos/asf/incubator/couchdb/trunk couchdb cd couchdb ./bootstrap - ./configure && make && make install + ./configure --with-erlang=/usr/lib64/erlang/usr/include && make && make install }}} 3. Edit config file to suit
[Couchdb Wiki] Update of "People on the Couch" by DannyGagne
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by DannyGagne: http://wiki.apache.org/couchdb/People_on_the_Couch -- * [[MailTo(jwalg...@gmail.com)]], [http://walgran.com/justin/ Homepage], [http://twitter.com/jwalgran Twitter] * Ryan Duffield (rduffield) * [[MailTo(duffi...@gmail.com)]], [http://www.ryanduffield.com/ Blog], [http://twitter.com/rduffield Twitter] + * Danny Gagne (dantheman) + * [[MailTo(da...@dannygagne.com)]], [http://dannygagne.com/ Homepage] == UTC-3 ==
[Couchdb Wiki] Trivial Update of "Frequently asked questions" by JanLehnardt
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by JanLehnardt: http://wiki.apache.org/couchdb/Frequently_asked_questions The comment on the change is: C -> C++ -- [[Anchor(what_language)]] == What Language is CouchDB Written in? == - Erlang, a concurrent, functional programming language with an emphasis on fault tolerance. Early work on CouchDB was started in C but was replaced by Erlang OTP platform. Erlang has so far proven an excellent match for this project. + Erlang, a concurrent, functional programming language with an emphasis on fault tolerance. Early work on CouchDB was started in C++ but was replaced by Erlang OTP platform. Erlang has so far proven an excellent match for this project. CouchDB's default view server uses Mozilla's Spidermonkey Javscript library which is written in C. It also supports easy integration of view servers written in any language.
[Couchdb Wiki] Update of "Plugin API use cases" by charlieok
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by charlieok: http://wiki.apache.org/couchdb/Plugin_API_use_cases The comment on the change is: Added "AMQP Notifier" - the idea is to send notifications to an AMQP Exchange -- * ["Action server proposal"] * ["Document runner plugin"] + * ["AMQP Notifier"]
[Couchdb Wiki] Update of "AMQP Notifier" by charlieok
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by charlieok: http://wiki.apache.org/couchdb/AMQP_Notifier New page: The idea for this plugin type would be a simple notifier that could post a message to an AMQP Exchange whenever a change is made to the database. A server such as RabbitMQ (a fellow noteworthy Erlang project of 2008!) could receive these messages and route them to listening queues in any manner desired. This could be useful for anything from high speed continuous replication between CouchDB instances to updating specialized indexes (such as fulltext or geospatial etc) or anything else one might want to do. This way listening for updates to a document database would be just like listening for any other type of message.
[Couchdb Wiki] Update of "AMQP Notifier" by charlieok
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by charlieok: http://wiki.apache.org/couchdb/AMQP_Notifier -- - The idea for this plugin type would be a simple notifier that could post a message to an AMQP Exchange whenever a change is made to the database. A server such as RabbitMQ (a fellow noteworthy Erlang project of 2008!) could receive these messages and route them to listening queues in any manner desired. This could be useful for anything from high speed continuous replication between CouchDB instances to updating specialized indexes (such as fulltext or geospatial etc) or anything else one might want to do. This way listening for updates to a document database would be just like listening for any other type of message. + The idea for this plugin type would be a simple notifier that could post a message to an AMQP Exchange whenever a change is made to a database. A server such as RabbitMQ (a fellow noteworthy Erlang project of 2008!) could receive these messages and route them to listening queues in any manner desired. This could be useful for anything from high speed continuous replication between CouchDB instances to updating specialized indexes (such as fulltext or geospatial etc) or anything else one might want to do. This way listening for updates to a document database would be just like listening for any other type of message.
[Couchdb Wiki] Update of "AMQP Notifier" by charlieok
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by charlieok: http://wiki.apache.org/couchdb/AMQP_Notifier -- The idea for this plugin type would be a simple notifier that could post a message to an AMQP Exchange whenever a change is made to a database. A server such as RabbitMQ (a fellow noteworthy Erlang project of 2008!) could receive these messages and route them to listening queues in any manner desired. This could be useful for anything from high speed continuous replication between CouchDB instances to updating specialized indexes (such as fulltext or geospatial etc) or anything else one might want to do. This way listening for updates to a document database would be just like listening for any other type of message. + A nice advantage of organizing things this way is that a CouchDB instance would only need to notifiy one application -- the messaging server -- even if 15 applications are listening for updates. Once a description of the database change has been sent to an exchange, CouchDB's work is done and it becomes the messaging server's job to deliver the notification to all the listeners. +
[Couchdb Wiki] Update of "Related Projects" by PaulCarey
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by PaulCarey: http://wiki.apache.org/couchdb/Related_Projects The comment on the change is: Added fuschia -- == Clients == + * [http://code.google.com/p/couchdb-fuse/ CouchDB-FUSE: mount document attachments on a virtual filesystem] + * [http://github.com/paulcarey/fuschia/tree/master Fuschia is a graphical document browser for CouchDB] + * [http://dansickles.blogs.com/weblog/2006/09/levitz.html Levitz - XUL based CouchDb utility client] * ["Valance"] GUI client in PyGTK - * [http://dansickles.blogs.com/weblog/2006/09/levitz.html Levitz - XUL based CouchDb utility client] - * [http://code.google.com/p/couchdb-fuse/ CouchDB-FUSE: mount document attachments on a virtual filesystem] == Libraries ==
[Couchdb Wiki] Update of "AMQP Notifier" by SteveRogers
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by SteveRogers: http://wiki.apache.org/couchdb/AMQP_Notifier -- - The idea for this plugin type would be a simple notifier that could post a message to an AMQP Exchange whenever a change is made to a database. A server such as RabbitMQ (a fellow noteworthy Erlang project of 2008!) could receive these messages and route them to listening queues in any manner desired. This could be useful for anything from high speed continuous replication between CouchDB instances to updating specialized indexes (such as fulltext or geospatial etc) or anything else one might want to do. This way listening for updates to a document database would be just like listening for any other type of message. + The idea for this plugin type would be a simple notifier that could post a message to an [http://en.wikipedia.org/wiki/Advanced_Message_Queuing_Protocol AMQP] Exchange whenever a change is made to a database. A server such as [http://www.rabbitmq.com/ RabbitMQ] (a fellow noteworthy Erlang project of 2008!) could receive these messages and route them to listening queues in any manner desired. This could be useful for anything from high speed continuous replication between CouchDB instances to updating specialized indexes (such as fulltext or geospatial etc) or anything else one might want to do. This way listening for updates to a document database would be just like listening for any other type of message. A nice advantage of organizing things this way is that a CouchDB instance would only need to notifiy one application -- the messaging server -- even if 15 applications are listening for updates. Once a description of the database change has been sent to an exchange, CouchDB's work is done and it becomes the messaging server's job to deliver the notification to all the listeners.
[Couchdb Wiki] Trivial Update of "HTTP Document API" by NoahSlater
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by NoahSlater: http://wiki.apache.org/couchdb/HTTP_Document_API -- === Accessing Previous Revisions === - See ["DocumentRevisions"] for additional notes on revisions. + See ["DocumentRevisions"] for additional notes on revisions. The above example gets the current revision. You can get a specific revision by using the following syntax:
[Couchdb Wiki] Trivial Update of "Installing on OSX" by JanLehnardt
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by JanLehnardt: http://wiki.apache.org/couchdb/Installing_on_OSX The comment on the change is: update svn url -- == Typical build process of a CouchDB developer build == {{{ - $ svn checkout http://svn.apache.org/repos/asf/incubator/couchdb/trunk couchdb + $ svn co http://svn.apache.org/repos/asf/couchdb/trunk couchdb $ cd couchdb $ ./bootstrap && ./configure $ make
[Couchdb Wiki] Update of "View Snippets" by MarcaJames
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by MarcaJames: http://wiki.apache.org/couchdb/View_Snippets -- } }}} + + == Computing simple summary statistics (min,max,mean,standard deviation) == + + Here is some code I have developed to compute standard deviation. I do it two ways, both of which are different from jchris' github version (add link?). In practice of course you wouldn't need both ways. The view is specialized to my dataset, but the reduce function might be useful to others. + + I've only ever tested it on futon, and have no idea what the "group" parameter does to the output. Probably nothing! + + {{{ + // Map function + function(doc) { + var risk_exponent = + -3.194 + + doc.CV_VOLOCC_1 *1.080 + + doc.CV_VOLOCC_M *0.627 + + doc.CV_VOLOCC_R *0.553 + + doc.CORR_VOLOCC_1M *1.439 + + doc.CORR_VOLOCC_MR *0.658 + + doc.LAG1_OCC_M *0.412 + + doc.LAG1_OCC_R *1.424 + + doc.MU_VOL_1*0.038 + + doc.MU_VOL_M*0.100 + + doc["CORR_OCC_1M X MU_VOL_M"] *-0.168 + + doc["CORR_OCC_1M X SD_VOL_R" ] *0.479 + + doc["CORR_OCC_1M X LAG1_OCC_R"]*-1.462 ; + + var risk = Math.exp(risk_exponent); + + // parse the date and "chunk" it up + var pattern = new RegExp("(.*)-0?(.*)-0?(.*)T0?(.*):0?(.*):0?(.*)(-0800)"); + var result = pattern.exec(doc.EstimateTime); + var day; + if(result){ + //new Date(year, month, day, hours, minutes, seconds, ms) + // force rounding to 5 minutes, 0 seconds, for aggregation of 5 minute chunks + var fivemin = 5 * Math.floor(result[5]/5) + day = new Date(result[1],result[2]-1,result[3],result[4], fivemin, 0); + } + var weekdays = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]; + emit([weekdays[day.getDay()],day.toLocaleTimeString( )],{'risk':risk}); + } + + // Reduce function + function (keys, values, rereduce) { + + // algorithm for on-line computation of moments from + // + //Tony F. Chan, Gene H. Golub, and Randall J. LeVeque: "Updating + //Formulae and a Pairwise Algorithm for Computing Sample + //Variances." Technical Report STAN-CS-79-773, Department of + //Computer Science, Stanford University, November 1979. url: + // ftp://reports.stanford.edu/pub/cstr/reports/cs/tr/79/773/CS-TR-79-773.pdf + + // so there is some wierdness in that the original was Fortran, index from 1, + // and lots of arrays (no lists, no hash tables) + + + // also consulted http://people.xiph.org/~tterribe/notes/homs.html + // and http://www.jstor.org/stable/2683386 + // and (ick!) the wikipedia description of Knuth's algorithm + // to clarify what was going on with http://www.slamb.org/svn/repos/trunk/projects/common/src/java/org/slamb/common/stats/Sample.java + + /* +combine the variance esitmates for two partitions, A and B. +partitionA and partitionB both should contain + { S : the current estimate of the second moment + Sum : the sum of observed values + M : the number of observations used in the partition to calculate S and Sum + } + + The output will be an identical object, containing the S, Sum and + M for the combination of partitions A and B + + This routine is derived from original fortran code in Chan et al, + (1979) + + But it is easily derived by recognizing that all you're doing is + multiplying each partition's S and Sum by its respective count M, + and then dividing by the new count Ma + Mb. The arrangement of + the diff etc is just rearranging terms to make it look nice. + + And then summing up the sums, and summing up the counts + + */ + function combine_S(partitionA,partitionB){ + var NewS=partitionA.S; + var NewSum=partitionA.Sum; + var min = partitionA.min; + var max = partitionA.max; + var M = partitionB.M; + if(!M){M=0;} + if(M){ + var diff = + ((partitionA.M * partitionB.Sum / partitionB.M) - partitionA.Sum ); + + NewS += partitionB.S + partitionB.M*diff*diff/(partitionA.M * (partitionA.M+partitionB.M) ); + NewSum += partitionB.Sum ; + + min = Math.min(partitionB.min, min); + max = Math.max(partitionB.max, max); + } + return {'S':NewS,'Sum':NewSum, 'M': partitionA.M+M, 'min':min, 'max':max }; + } + + + /* + + This routine is derived from original fortran code in Chan et al, + (1979), with the combination step split out
[Couchdb Wiki] Update of "Introduction to CouchDB views" by JanLehnardt
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by JanLehnardt: http://wiki.apache.org/couchdb/Introduction_to_CouchDB_views -- '''Temporary views''' are not stored in the database, but rather executed on demand. To execute a temporary view, you make an HTTP ''POST'' request to the URI ''/{dbname}/_slow_view'', where the body of the request contains the code of the view function and the ''Content-Type'' header is set to ''application/json''. - '''NOTE''': Temporary views are only good during development. Final code should not rely on them as they are very expensive to compute each time they get called and they get increasingly slower the more data you have in a database. If you think you can't solve something in a permanent view that you can solve in an ad-hoc view, you might want to reconsider. (TODO: add typical examples and solutions). + '''NOTE''': '''Temporary views are only good during development'''. Final code should not rely on them as they are very expensive to compute each time they get called and they get increasingly slower the more data you have in a database. If you think you can't solve something in a permanent view that you can solve in an ad-hoc view, you might want to reconsider. (TODO: add typical examples and solutions). For both kinds of views, the view is defined by a !JavaScript function that maps view keys to values (although it is possible to use other languages than !JavaScript by plugging in third-party view servers).
[Couchdb Wiki] Update of "People on the Couch" by LenzGschwendtner
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by LenzGschwendtner: http://wiki.apache.org/couchdb/People_on_the_Couch -- * Tim Carey-Smith (`halorgium`) * [http://twitter.com/halorgium Twitter] + * Lenz Gschwendtner (`norbu09`) + * [[MailTo(norb...@googlemail.com)]], [http://who.wants.in Blog]
[Couchdb Wiki] Update of "People on the Couch" by heycarsten
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by heycarsten: http://wiki.apache.org/couchdb/People_on_the_Couch The comment on the change is: Added myself to the end of the UTC-5 list. -- * [[MailTo(duffi...@gmail.com)]], [http://www.ryanduffield.com/ Blog], [http://twitter.com/rduffield Twitter] * Danny Gagne (dantheman) * [[MailTo(da...@dannygagne.com)]], [http://dannygagne.com/ Homepage] + * Carsten Nielsen (heycarsten) + * [[MailTo(heycars...@gmail.com)]], [http://heycarsten.com Blog], [http://github.com/heycarsten GitHub], [http://twitter.com/heycarsten Twitter] == UTC-3 ==
[Couchdb Wiki] Update of "ExternalProcesses" by JasonDavies
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by JasonDavies: http://wiki.apache.org/couchdb/ExternalProcesses The comment on the change is: Added missing information about returning base64-encoded data -- == JSON Response == - The response object has four possible elements + The response object has five possible elements * ''code'' - HTTP response code [Default is 200] * ''headers'' - An object with key-value pairs that specify HTTP headers to send to the client * ''json'' - An arbitrary JSON object to send the client. Automatically sets the Content-Type header to "application/json" - * ''body'' - An arbitrary BLOB to be sent to the client. Content-Type header default's to "text/html" + * ''body'' - An arbitrary BLOB to be sent to the client. Content-Type header defaults to "text/html" + * ''base64'' - Arbitrary binary data for the response body, base64-encoded While nothing breaks if you specify both a ''json'' and ''body'' member, it is undefined which response will be used. If you specify a Content-Type header in the ''headers'' member, it will override the default.
[Couchdb Wiki] Update of "People on the Couch" by MattLiggett
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by MattLiggett: http://wiki.apache.org/couchdb/People_on_the_Couch -- * [[MailTo(da...@dannygagne.com)]], [http://dannygagne.com/ Homepage] * Carsten Nielsen (heycarsten) * [[MailTo(heycars...@gmail.com)]], [http://heycarsten.com Blog], [http://github.com/heycarsten GitHub], [http://twitter.com/heycarsten Twitter] + * Matt Liggett (mml`) + * [[MailTo(m...@pobox.com)]], [http://mml.name/ Homepage], [http://twitter.com/mml Twitter] == UTC-3 ==
[Couchdb Wiki] Update of "CouchDB in the wild" by Kowsik
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by Kowsik: http://wiki.apache.org/couchdb/CouchDB_in_the_wild -- * [http://peasized.net/ Pea Sized], a simple band web site * [http://iwantmyname.com/ iWantMyName], an easy to use domain registrar (finally) * [http://coravy.com/ coravy. website], corporate website using a non-cms build with CouchDB. + * [http://www.pcapr.net/ pcapr], a packet capture sharing, viewing, editing website. == Facebook Applications == * [http://apps.facebook.com/ukissme/ Will you Kissme], Dating game
[Couchdb Wiki] Update of "People on the Couch" by RyanFunduk
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by RyanFunduk: http://wiki.apache.org/couchdb/People_on_the_Couch -- * [[MailTo(heycars...@gmail.com)]], [http://heycarsten.com Blog], [http://github.com/heycarsten GitHub], [http://twitter.com/heycarsten Twitter] * Matt Liggett (mml`) * [[MailTo(m...@pobox.com)]], [http://mml.name/ Homepage], [http://twitter.com/mml Twitter] + * Ryan Funduk (thenduks) + * [http://ryanfunduk.com Blog] == UTC-3 ==
[Couchdb Wiki] Update of "HTTP database API" by JanLehnardt
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by JanLehnardt: http://wiki.apache.org/couchdb/HTTP_database_API The comment on the change is: document slash-in-database-name trick. -- ''Rationale for character restrictions'' The limited set of characters for database names is driven by the need to satisfy the lowest common denominator for file system naming conventions. For example, disallowing uppercase characters makes compliance with case insensitive file systems straightforward. + + All database files are stored in a single directory on the file system. If your database includes a ''/'' CouchDB will create a sub-directory structure in the database directory. That is, a database named ''his/her'', the database file will be available at ''$dbdir/his/her.couch''. This is useful when you a large number of databases and your file system does not like that. + == List Databases ==
[Couchdb Wiki] Update of "People on the Couch" by FellingerMichael
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by FellingerMichael: http://wiki.apache.org/couchdb/People_on_the_Couch -- * Thomas Kerpe (brxs) * [http://www.toke.de/blog/ Blog], [http://twitter.com/brxs Twitter] + == UTC+9 == + + * Michael Fellinger (manveru) + * [[MailTo(m.fellin...@gmail.com)]], [http://twitter.com/manveru Twitter], [http://github.com/manveru Github] + == UTC+10 (+11) == * Volker Mische (vmx)
[Couchdb Wiki] Update of "Installation" by JanLehnardt
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by JanLehnardt: http://wiki.apache.org/couchdb/Installation The comment on the change is: add page for apache proxy config -- '''Verifying the Installation''' * ["Verify and Test Your Installation"] + '''Third Party Tool Configuration''' + * ["Apache As a Reverse Proxy"] +
[Couchdb Wiki] Update of "Apache As a Reverse Proxy" by JanLehnardt
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by JanLehnardt: http://wiki.apache.org/couchdb/Apache_As_a_Reverse_Proxy New page: By Patrick Antivackis: ServerAdmin webmas...@dummy-host.example.com DocumentRoot "/opt/websites/web/www/dummy" ServerName couchdb.localhost AllowEncodedSlashes On ProxyRequests Off Order deny,allow Deny from all Allow from 88.164.1.48 Allow from 127.0.0.1 ProxyPass / http://localhost:5984/ nocanon ProxyPassReverse / http://localhost:5984/ ErrorLog "logs/couchdb.localhost-error_log" CustomLog "logs/couchdb.localhost-access_log" common
[Couchdb Wiki] Trivial Update of "Apache As a Reverse Proxy" by JanLehnardt
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by JanLehnardt: http://wiki.apache.org/couchdb/Apache_As_a_Reverse_Proxy The comment on the change is: formatting -- By Patrick Antivackis: + {{{ ServerAdmin webmas...@dummy-host.example.com DocumentRoot "/opt/websites/web/www/dummy" @@ -19, +20 @@ ErrorLog "logs/couchdb.localhost-error_log" CustomLog "logs/couchdb.localhost-access_log" common + }}}
[Couchdb Wiki] Update of "Apache As a Reverse Proxy" by PatrickAntivackis
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by PatrickAntivackis: http://wiki.apache.org/couchdb/Apache_As_a_Reverse_Proxy -- By Patrick Antivackis: + + This is a Virtual Host config to use Apache as a reverse Proxy for CouchDB. + You need at least to configure apache with the --enable-proxy --enable-proxy-http options and use a version higher than Apache 2.2.7 + in order to use the nocanon option in the ProxyPass directive. {{{ @@ -12, +16 @@ Order deny,allow Deny from all - Allow from 88.164.1.48 Allow from 127.0.0.1 ProxyPass / http://localhost:5984/ nocanon
[Couchdb Wiki] Update of "Apache As a Reverse Proxy" by PatrickAntivackis
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by PatrickAntivackis: http://wiki.apache.org/couchdb/Apache_As_a_Reverse_Proxy -- This is a Virtual Host config to use Apache as a reverse Proxy for CouchDB. You need at least to configure apache with the --enable-proxy --enable-proxy-http options and use a version higher than Apache 2.2.7 - in order to use the nocanon option in the ProxyPass directive. + in order to use the nocanon option in the proxypass directive. {{{
[Couchdb Wiki] Update of "Apache As a Reverse Proxy" by PatrickAntivackis
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by PatrickAntivackis: http://wiki.apache.org/couchdb/Apache_As_a_Reverse_Proxy -- By Patrick Antivackis: This is a Virtual Host config to use Apache as a reverse Proxy for CouchDB. - You need at least to configure apache with the --enable-proxy --enable-proxy-http options and use a version higher than Apache 2.2.7 + You need at least to configure apache with the --enable-proxy --enable-proxy-http options and use a version equal or higher than Apache 2.2.7 in order to use the nocanon option in the proxypass directive. {{{
[Couchdb Wiki] Update of "Apache As a Reverse Proxy" by GlennRempe
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by GlennRempe: http://wiki.apache.org/couchdb/Apache_As_a_Reverse_Proxy -- ServerName couchdb.localhost AllowEncodedSlashes On ProxyRequests Off +KeepAlive Off Order deny,allow Deny from all
[Couchdb Wiki] Update of "CouchDB in the wild" by blackmagic rue
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by blackmagic rue: http://wiki.apache.org/couchdb/CouchDB_in_the_wild -- * [http://github.com/jtulloch/scanty/tree/master Scanty on the Couch], a port of Adam Wiggins' Scanty blog software == Websites == + * [http://www.gpirate.com/ Gpirate], world's biggest torrent search engine * [http://www.teenwag.com/ Teenwag], a Teen Social network * [http://www.youfindr.com/ Youfindr], a Social search engine * [http://www.wego.com/ Wego], a travel search website @@ -30, +31 @@ == Facebook Applications == * [http://apps.facebook.com/ukissme/ Will you Kissme], Dating game * [http://apps.facebook.com/getlucky/ Horoscope], Horoscopes - + * [http://apps.facebook.com/bdayecards/ Birthday Greeting cards], Greeting cards == Internal Use ==
[Couchdb Wiki] Trivial Update of "View Snippets" by GlennRempe
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by GlennRempe: http://wiki.apache.org/couchdb/View_Snippets -- - This page collects code snippets to be used in your ["Views"]. They are mainly ment to help getting your head arround the map/reduce approach to databases. Keep in mind that the the Futon Web-Client silently adds group=true to your views. + This page collects code snippets to be used in your ["Views"]. They are mainly meant to help get your head around the map/reduce approach to accessing database content. Keep in mind that the the Futon web client silently adds group=true to your views. == Get docs with a particular user id ==
[Couchdb Wiki] Trivial Update of "View Snippets" by GlennRempe
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by GlennRempe: http://wiki.apache.org/couchdb/View_Snippets The comment on the change is: Spelling -- Then query with key=USER_ID to get all the rows that match that user. - == Get all documents which have an attatchment == + == Get all documents which have an attachment == This lists only the documents which have an attachment. @@ -29, +29 @@ In SQL this would be something like {{{SELECT if FROM table WHERE attachment IS NOT NULL}}}. - == Count documents which and without an attachment == + == Count documents with and without an attachment == Call this with ''group=true'' or you only get the combined number of documents witch and without attachments.
[Couchdb Wiki] Update of "View Snippets" by GlennRempe
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by GlennRempe: http://wiki.apache.org/couchdb/View_Snippets The comment on the change is: Spelling -- == Count documents with and without an attachment == - Call this with ''group=true'' or you only get the combined number of documents witch and without attachments. + Call this with ''group=true'' or you only get the combined number of documents with and without attachments. {{{ map: function(doc) { if (doc._attachments) { - emit("with attatchment", 1); + emit("with attachment", 1); } else { - emit("without attatchment", 1); + emit("without attachment", 1); } } reduce: function(keys, values) {
[Couchdb Wiki] Update of "CouchDB in the wild" by NoahSlater
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by NoahSlater: http://wiki.apache.org/couchdb/CouchDB_in_the_wild -- A list of software and websites using CouchDB in the wild, please add yours! + + @@ add disclaimer about non-endorsement == Software == @@ -13, +15 @@ * [http://github.com/jtulloch/scanty/tree/master Scanty on the Couch], a port of Adam Wiggins' Scanty blog software == Websites == + + @@ add proper rules about inclusion in this list, must have justification + + * [http://pylonshq.com/ PylonsHQ], the Pylons Web framework website * [http://www.gpirate.com/ Gpirate], world's biggest torrent search engine * [http://www.teenwag.com/ Teenwag], a Teen Social network * [http://www.youfindr.com/ Youfindr], a Social search engine
[Couchdb Wiki] Update of "CouchDB in the wild" by NoahSlater
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by NoahSlater: http://wiki.apache.org/couchdb/CouchDB_in_the_wild -- @@ add proper rules about inclusion in this list, must have justification - * [http://pylonshq.com/ PylonsHQ], the Pylons Web framework website + * [http://pylonshq.com/ PylonsHQ], the Pylons Web framework website - [http://pylonshq.com/articles/archives/2009/1/new_pylonshq_site_launches (explanation)] * [http://www.gpirate.com/ Gpirate], world's biggest torrent search engine * [http://www.teenwag.com/ Teenwag], a Teen Social network * [http://www.youfindr.com/ Youfindr], a Social search engine
[Couchdb Wiki] Update of "Getting started with Objective-C" by RobertEvans
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by RobertEvans: http://wiki.apache.org/couchdb/Getting_started_with_Objective-C -- - See [http://code.brautaset.org/CouchObjC/] for more information. + See [http://code.brautaset.org/CouchObjC/] for more information or [http://github.com/objectiveous/couchobj/tree/master].
[Couchdb Wiki] Update of "Getting started with Objective-C" by RobertEvans
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by RobertEvans: http://wiki.apache.org/couchdb/Getting_started_with_Objective-C -- - See [http://code.brautaset.org/CouchObjC/] for more information or [http://github.com/objectiveous/couchobj/tree/master]. + See [http://code.brautaset.org/CouchObjC/]for more information or checkout a this branch [http://github.com/objectiveous/couchobj/tree/master].
[Couchdb Wiki] Trivial Update of "Installing on RHEL5" by BrianCandler
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by BrianCandler: http://wiki.apache.org/couchdb/Installing_on_RHEL5 The comment on the change is: Fix SVN URL -- 2. Install couchdb {{{ - svn checkout http://svn.apache.org/repos/asf/incubator/couchdb/trunk couchdb + svn checkout http://svn.apache.org/repos/asf/couchdb/trunk couchdb cd couchdb ./bootstrap ./configure --with-erlang=/usr/lib64/erlang/usr/include && make && make install
[Couchdb Wiki] Update of "Contributing" by ChrisAnderson
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by ChrisAnderson: http://wiki.apache.org/couchdb/Contributing The comment on the change is: deleted old information about development ini file -- == Running CouchDB From the Source Directory == - From the checkout directory, first perform the `./bootstrap`, `./configure`, and `make` steps so that everything gets built properly. + This is documented on the page ["Running_Couchdb_in_Dev_Mode"] - Then create a configuration file that you'll use for running CouchDB directly from the source directory. We'll call it `couch_dev.ini` and drop it directly into the checkout directory, with the following content: (Note that we have CouchDB running on port 5985, so that it doesn't conflict with any existing running instance on the standard port.) - - {{{ - [couchdb] - allow_remote_restart = true - database_dir = . - util_driver_dir = src/couchdb/.libs - - [httpd] - port = 5985 - utils_dir = share/www - - [log] - file = couch.log - level = debug - - [query_servers] - javascript = src/couchdb/couchjs share/server/main.js - }}} - - Note that we use relative paths for anything that's in the checkout (such as the static resources and the Javascript view server). For the database directory and the log file, we're using the current working directory here, but it could really be anything you'd like (such as a directory in `/tmp`). - - Now you can fire up CouchDB as follows. Do this from the top of the checkout directory so that the relative paths we put in the configuration file work correctly. - - {{{ - ./bin/couchdb -c couch_dev.ini - }}} - - Note the runtime configurations will be written to the last file specified after a `-c` directive, so if you'd like to write changes back to an ini file, append something like `-c local_dev.ini` to the above command line. - - When CouchDB starts, you should see: - - {{{ - Apache CouchDB 0.9.0a690675-incubating (LogLevel=debug) is starting. - Configuration Settings ["couch_dev.ini"]: - [couchdb] allow_remote_restart="true" - [couchdb] database_dir="." - [couchdb] util_driver_dir="src/couchdb/.libs" - [httpd] port="5985" - [httpd] utils_dir="share/www" - [log] file="couch.log" - [log] level="debug" - [query_servers] javascript="src/couchdb/couchjs share/server/main.js" - Apache CouchDB has started. Time to relax. - }}} - - CouchDB should now be running and you can try accessing the HTTP interface by visiting http://127.0.0.1:5985/. -
[Couchdb Wiki] Update of "People on the Couch" by JasonKraus
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by JasonKraus: http://wiki.apache.org/couchdb/People_on_the_Couch -- * [http://urbanhonking.com/ideasfordozens Blog], [http://twitter.com/atduskgreg Twitter] * Mel Gray (melito) * [[MailTo(melg...@gmail.com)]], [http://twitter.com/melgray Twitter], [http://melgray.org/ Tumblr] + * Jason Kraus (zbyte64) + * [[MailTo(zbyt...@gmail.com)]], [http://www.zbyte64.com Homepage] == UTC-7 ==
[Couchdb Wiki] Update of "HTTP status list" by Scott Shumaker
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by Scott Shumaker: http://wiki.apache.org/couchdb/HTTP_status_list -- === 404 - Not Found === Such as a request via the HttpDocumentApi for a document which doesn't exist. + + === 405 - Resource Not Allowed === + + Request was accessing a non-existent URL. For example, if you have a malformed URL, or are using a third party library that is targeting a different version of CouchDB. === 406 - Not Acceptable ===
[Couchdb Wiki] Update of "How to replicate a database" by BrianCandler
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by BrianCandler: http://wiki.apache.org/couchdb/How_to_replicate_a_database -- It is important to specific the database name in the URL as Futon does not assume anything with respect to the source or destination database based upon the originating or destination database. - == Operational Hints = + == Operational Hints == + + Replication is one-way. In a multi-master scenario you have to issue one replication from A to B, and a separate one from B to A. Currently it seems that "pull" replication where you have a remote source and and a local target is much more reliable than "push" where you have it the other way around. + == Playing with Replication == + + It's straightforward to set up two test couchdb instances on the same machine. Here is local1.ini: + + {{{ + ; Remember to create the directories: + ; mkdir -p /var/tmp/couchdb1/{data,log} + ; + ; Start using: + ; couchdb -c /usr/local/etc/couchdb/default.ini -c local1.ini + + [couchdb] + database_dir = /var/tmp/couchdb1/data + + [log] + file = /var/tmp/couchdb1/log/couch.log + + [httpd] + port = 5001 + }}} + + Similarly local2.ini: + + {{{ + ; Remember to create the directories: + ; mkdir -p /var/tmp/couchdb2/{data,log} + ; + ; Start using: + ; couchdb -c /usr/local/etc/couchdb/default.ini -c local2.ini + + [couchdb] + database_dir = /var/tmp/couchdb2/data + + [log] + file = /var/tmp/couchdb2/log/couch.log + + [httpd] + port = 5002 + }}} + + Test they are both running: + + {{{ + $ curl http://localhost:5001/ + {"couchdb":"Welcome","version":"0.9.0a738034-incubating"} + $ curl http://localhost:5002/ + {"couchdb":"Welcome","version":"0.9.0a738034-incubating"} + }}} + + === Create and replicate a document === + + {{{ + $ curl -X PUT http://localhost:5001/sampledb + {"ok":true} + $ curl -X PUT http://localhost:5002/sampledb + {"ok":true} + + $ curl -X PUT -d '{"hello":"world"}' http://localhost:5001/sampledb/doc1 + {"ok":true,"id":"doc1","rev":"3851869530"} + + $ curl -X POST -d '{"source":"http://127.0.0.1:5001/sampledb","target":"sampledb"}' \ + http://localhost:5002/_replicate + { + "ok":true, + "session_id":"7118d54c40761eba83454aabae8ea91b", + "source_last_seq":0, + "history": + [ + { + "start_time":"Wed, 28 Jan 2009 16:26:09 GMT", + "end_time":"Wed, 28 Jan 2009 16:26:09 GMT", + "start_last_seq":0, + "end_last_seq":1, + "missing_checked":1, + "missing_found":1, + "docs_read":1, + "docs_written":1 + } + ] + } + }}} + + ''POST response has been reformatted for clarity'' + + {{{ + $ curl http://127.0.0.1:5001/sampledb/doc1 + {"_id":"doc1","_rev":"3851869530","hello":"world"} + $ curl http://127.0.0.1:5002/sampledb/doc1 + {"_id":"doc1","_rev":"3851869530","hello":"world"} + }}} + + === Create conflicting updates === + + ''Note: the updates have to be made on separate databases. Update conflicts can't occur within a single database; because you provide the original _rev, if someone else has already changed the document, the second update is rejected.'' + + {{{ + $ curl -X PUT -d '{"_rev":"3851869530","hello":"fred"}' http://localhost:5001/sampledb/doc1 + {"ok":true,"id":"doc1","rev":"132006080"} + $ curl -X PUT -d '{"_rev":"3851869530","hello":"jim"}' http://localhost:5002/sampledb/doc1 + {"ok":true,"id":"doc1","rev":"2575525432"} + + $ curl -X POST -d '{"source":"http://127.0.0.1:5001/sampledb","target":"sampledb"}' \ + http://localhost:5002/_replicate + {"ok":true,"session_id":"fe1ec1c66b0b916e7e87dd635b4dc572","source_last_seq":0,"history": + [{"start_time":"Wed, 28 Jan 2009 16:28:36 GMT","end_time":"Wed, 28 Jan 2009 16:28:36 GMT", + "start_last_seq":0,"end_last_seq":2,"missing_checked":1,"missing_found":1,"docs_read":1,"docs_written":1}]} + + $ curl http://127.0.0.1:5001/sampledb/doc1 + {"_id":"doc1","_rev":"132006080","hello":"fred"} + $ curl http://127.0.0.1:5002/sampledb/doc1 + {"_id":"doc1","_rev":"2575525432","hello":"jim"} + }}} + + At this point you can see the two databases still have different ideas about this document. You need to replicate back the other way as well: + + {{{ + $ curl -X POST -d '{"target":"http://127.0.0.1:5001/sampledb","source":"sampledb"}' \ + http://localhost:5002/_replicate + + {"ok":true,"session_id":"da0a07a0f9c9fb5c2d2e2769229257df","source_last_seq":0,"history": + [{"start_time":"Wed, 28 Jan 2009 16:30:23 GMT","end_time":"Wed, 28 Jan 2009 16:30:23 GMT", + "start_last_seq":0,"end_last_seq":3,"missing_checked":2,"missing_found":1,"docs_read":1,"docs_written":1}]} + + $ curl http://127.0.0.1:5001/sampledb/doc1?revs=true + {"_id":"doc1","_rev":"2575525432","hello":"jim","_revs":["2575525432","3851869530"]} + 3$ curl http://127.0.0.1:5002/sampled
[Couchdb Wiki] Update of "How to replicate a database" by BrianCandler
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by BrianCandler: http://wiki.apache.org/couchdb/How_to_replicate_a_database -- {"_id":"doc1","_rev":"3851869530","hello":"world"} }}} - === Create conflicting updates === + === Introduce conflicting updates === ''Note: the updates have to be made on separate databases. Update conflicts can't occur within a single database; because you provide the original _rev, if someone else has already changed the document, the second update is rejected.'' @@ -159, +159 @@ {"_id":"doc1","_rev":"2575525432","hello":"jim","_conflicts":["132006080"]} }}} + === Compaction === + + The conflict status, and the conflicting versions, remain even after compaction. However the very original version, which was not in conflict, does not. + + {{{ + $ curl -X POST http://localhost:5001/sampledb/_compact + {"ok":true} + $ curl -X POST http://localhost:5002/sampledb/_compact + {"ok":true} + $ curl http://127.0.0.1:5001/sampledb/doc1?conflicts=true + {"_id":"doc1","_rev":"2575525432","hello":"jim","_conflicts":["132006080"]} + $ curl http://127.0.0.1:5001/sampledb/doc1?rev=132006080 + {"_id":"doc1","_rev":"132006080","hello":"fred"} + $ curl http://127.0.0.1:5001/sampledb/doc1?rev=2575525432 + {"_id":"doc1","_rev":"2575525432","hello":"jim"} + $ curl http://127.0.0.1:5001/sampledb/doc1?rev=3851869530 + {"error":"{not_found,missing}","reason":"3851869530"} + }}} + + === Conflict Resolution === + + All nodes see the same conflict state and history, so any of them can resolve the conflict. + + ''FIXME: How to resolve the conflict? Simply writing a new version of the document is not sufficient.'' + + {{{ + $ curl -X PUT -d '{"_rev":"2575525432","hello":"resolved"}' http://localhost:5001/sampledb/doc1 + {"ok":true,"id":"doc1","rev":"923422654"} + $ curl http://127.0.0.1:5001/sampledb/doc1?conflicts=true + {"_id":"doc1","_rev":"923422654","hello":"resolved","_conflicts":["132006080"]} + }}} +
[Couchdb Wiki] Update of "How to replicate a database" by BrianCandler
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by BrianCandler: http://wiki.apache.org/couchdb/How_to_replicate_a_database The comment on the change is: Add sample shell script -- {"_id":"doc1","_rev":"923422654","hello":"resolved","_conflicts":["132006080"]} }}} + === Sample shell script === + + Running this script gives an easy way to demonstrate replication behaviour. + + {{{ + #!/bin/sh + set -xe + + HOST1=http://localhost:5001 + HOST2=http://localhost:5002 + LOCAL1=sampledb + LOCAL2=sampledb + DB1="$HOST1/$LOCAL1" + DB2="$HOST2/$LOCAL2" + + curl -X DELETE "$DB1"; echo + curl -X DELETE "$DB2"; echo + curl -X PUT "$DB1"; echo + curl -X PUT "$DB2"; echo + + resp=`curl -sX PUT -d "{\"hello\":\"world\"}" "${DB1}/doc1"` + echo "$resp"; echo + rev=`expr "$resp" : '.*"rev":"\([^"]*\)"'` + + # Replicate + curl -X POST -d "{\"source\":\"$DB1\",\"target\":\"$LOCAL2\"}" "$HOST2/_replicate"; echo + curl -s "$DB1/doc1" | grep world + curl -s "$DB2/doc1" | grep world + + # Now make conflicting changes + curl -sX PUT -d "{\"_rev\":\"$rev\",\"hello\":\"fred\"}" "${DB1}/doc1" + curl -sX PUT -d "{\"_rev\":\"$rev\",\"hello\":\"jim\"}" "${DB2}/doc1" + curl -s "$DB1/doc1" | grep fred + curl -s "$DB2/doc1" | grep jim + + # Replicate again, A->B. Conflict seen on B side only. + curl -X POST -d "{\"source\":\"$DB1\",\"target\":\"$LOCAL2\"}" "$HOST2/_replicate"; echo + echo "*** On first DB ***" + curl -s "$DB1/doc1?conflicts=true"; echo + echo "*** On second DB ***" + curl -s "$DB2/doc1?conflicts=true"; echo + + # Replicate again, B->A. Identical conflict on both sides. + curl -X POST -d "{\"target\":\"$DB1\",\"source\":\"$LOCAL2\"}" "$HOST2/_replicate"; echo + echo "*** On first DB ***" + curl -s "$DB1/doc1?conflicts=true"; echo + echo "*** On second DB ***" + curl -s "$DB2/doc1?conflicts=true"; echo + }}} +
[Couchdb Wiki] Update of "How to replicate a database" by BrianCandler
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by BrianCandler: http://wiki.apache.org/couchdb/How_to_replicate_a_database The comment on the change is: Add info about resolving conflicts plus a small shell script -- All nodes see the same conflict state and history, so any of them can resolve the conflict. - ''FIXME: How to resolve the conflict? Simply writing a new version of the document is not sufficient.'' + Nodes can continue to add new versions, but conflict remains: {{{ $ curl -X PUT -d '{"_rev":"2575525432","hello":"resolved"}' http://localhost:5001/sampledb/doc1 @@ -191, +191 @@ {"_id":"doc1","_rev":"923422654","hello":"resolved","_conflicts":["132006080"]} }}} + Once the application is satisfied that it has resolved the conflict, it simply has to DELETE the conflicting revision. Couch actually keeps a separate list of deleted conflict revisions that you can view with "deleted_conflicts=true" + + {{{ + $ curl -X DELETE http://127.0.0.1:5001/sampledb/doc1?rev=132006080 + {"ok":true,"id":"doc1","rev":"3699698383"} + $ curl http://127.0.0.1:5001/sampledb/doc1?conflicts=true + {"_id":"doc1","_rev":"804871722","hello":"resolved"} + $ curl http://127.0.0.1:5001/sampledb/doc1?deleted_conflicts=true + {"_id":"doc1","_rev":"804871722","hello":"resolved","_deleted_conflicts":["3699698383"]} + }}} + === Sample shell script === - Running this script gives an easy way to demonstrate replication behaviour. + Running this script gives an easy way to set up a replication conflict so you can examine it and resolve it. {{{ #!/bin/sh
[Couchdb Wiki] Update of "View Snippets" by MarcaJames
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by MarcaJames: http://wiki.apache.org/couchdb/View_Snippets The comment on the change is: small spelling and typo corrections, and added my name to my contribution -- == Computing simple summary statistics (min,max,mean,standard deviation) == + + Implementation in {{{JavaScript}}} by MarcaJames. Mistakes in coding are my fault, algorithms are from others, as noted. To the best of my knowledge the algorithms are public domain, and my implementation freely available to all (Perl Artistic License if you really need a license to consult) Here is some code I have developed to compute standard deviation. I do it two ways, both of which are different from jchris' github version (add link?). In practice of course you wouldn't need both ways. The view is specialized to my dataset, but the reduce function might be useful to others. @@ -244, +246 @@ //Computer Science, Stanford University, November 1979. url: // ftp://reports.stanford.edu/pub/cstr/reports/cs/tr/79/773/CS-TR-79-773.pdf - // so there is some wierdness in that the original was Fortran, index from 1, + // so there is some weirdness in that the original was Fortran, index from 1, // and lots of arrays (no lists, no hash tables) @@ -318, +320 @@ The fifth parameter is for the running min, and the sixth for the max. - Pass for parameters 2 through 6 if you need to pass a key in the + Pass "null" for parameters 2 through 6 if you need to pass a key in the seventh slot. Some notes on the algorithm. There is a precious bit of trickery @@ -445, +447 @@ The first parameter is again values, a list of objects with the expectation that the variable of interest is contained under the key 'risk'. If this is not the case, pass the correct variable in the 7th field. - Parameters 2 through 6 are all optional. Pass nulls if you need to pass a key. + Parameters 2 through 6 are all optional. Pass nulls if you need to pass a key in slot 7. In order they are
[Couchdb Wiki] Update of "Frequently asked questions" by JanLehnardt
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by JanLehnardt: http://wiki.apache.org/couchdb/Frequently_asked_questions The comment on the change is: Add FaQ for relationships / joins -- === Views === * [#update_views_more_often I want to update my view indexes more often than only when a user reads it. How do I do that best?] * [#slow_view_building Creating my view index takes ages, WTF?] + * [#relationships How do I model relationships in CouchDB? / Where are my JOINs?] === Security === * [#secure_remote_server I use CouchDB on a remote server and I don't want it to listen on a public port for security reasons. Is there a way to connect to it from my local machine or can I still use Futon with it?] @@ -178, +179 @@ 3) You are using Erlang release R11B (or 5.5.x). Update to at least R12B-3 (or 5.6.3). + [[Anchor(relationships)]] + == How do I model relationships in CouchDB? / Where are my JOINs? == + + See: http://www.cmlenz.net/archives/2007/10/couchdb-joins + [[Anchor(finding_the_logfiles)]] == Where are the Couchdb logfiles located? ==
[Couchdb Wiki] Update of "HTTP view API" by ChrisAnderson
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by ChrisAnderson: http://wiki.apache.org/couchdb/HTTP_view_API The comment on the change is: document stale=ok, closes COUCHDB-77 -- * endkey=keyvalue * endkey_docid=docid * limit=max rows to return ''This used to be called "count" previous to Trunk SVN r731159'' - * update=false + * stale=ok * descending=true * skip=number of rows to skip * group=true ''Version 0.8.0 and forward'' @@ -168, +168 @@ The ''skip'' option should only be used with small values, as skipping a large range of documents this way is inefficient (it scans the index from the startkey and then skips N elements, but still needs to read all the index values to do that). For efficient paging use ''startkey'' and/or ''startkey_docid''. - The ''update'' option can be used for higher performance at the cost of possibly not seeing the all latest data. If you set the ''update'' option to ''false'', CouchDB will not perform any refreshing on the view that may be necessary. + The ''stale'' option can be used for higher performance at the cost of possibly not seeing the all latest data. If you set the ''stale'' option to ''ok'', CouchDB may not perform any refreshing on the view that may be necessary. Using this option essentially tells CouchDB that if a reference to the view index is available in memory, go ahead and use it, even if it may be out of date. The result is that for a highly trafficked view, end users can see lower latency, although they may not get the latest data. However, if there is no view index pointer in memory, the behavior with this option is that same as the behavior without the option. If your application use ''stale=ok'' for end-user queries, you'll need either a cron or a notification process like the one described in ["Regenerating views on update"], which queries without ''stale=ok'' to ensure that the view is kept reasonably up to date. View rows are sorted by the key; specifying ''descending=true'' will reverse their order. Note that the ''descending'' option is applied before any key filtering, so you may need to swap the values of the ''startkey'' and ''endkey'' options to get the expected results. The sorting itself is described in ViewCollation.
[Couchdb Wiki] Update of "Introduction to CouchDB views" by BrianCandler
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by BrianCandler: http://wiki.apache.org/couchdb/Introduction_to_CouchDB_views -- See HttpViewApi to learn how to work with views. ["View_Snippets"] contain a few examples. + == Restrictions on map and reduce functions === + + The restriction on map functions is that they must be referentially transparent. That is, given the same input document, they will always emit the same key/value pairs. This allows CouchDB views to be updated incrementally, only reindexing the documents that have changed since the last index update. + + To make incremental Map/Reduce possible, the Reduce function has the requirement that not only must it be referentially transparent, but it must also be commutative and associative for the array value input, to be able reduce on its own output and get the same answer, like this: + + f(Key, Values) == f(Key, [ f(Key, Values) ] ) + + This requirement of reduce functions allows CouchDB to store off intermediated reductions directly into inner nodes of btree indexes, and the view index updates and retrievals will have logarithmic cost. It also allows the indexes to be spread across machines and reduced at query time with logarithmic cost. + + For more details see [http://damienkatz.net/2008/02/incremental_map.html this blog post] +
[Couchdb Wiki] Update of "Introduction to CouchDB views" by BrianCandler
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by BrianCandler: http://wiki.apache.org/couchdb/Introduction_to_CouchDB_views -- See HttpViewApi to learn how to work with views. ["View_Snippets"] contain a few examples. - == Restrictions on map and reduce functions === + == Restrictions on map and reduce functions == The restriction on map functions is that they must be referentially transparent. That is, given the same input document, they will always emit the same key/value pairs. This allows CouchDB views to be updated incrementally, only reindexing the documents that have changed since the last index update. To make incremental Map/Reduce possible, the Reduce function has the requirement that not only must it be referentially transparent, but it must also be commutative and associative for the array value input, to be able reduce on its own output and get the same answer, like this: + {{{ f(Key, Values) == f(Key, [ f(Key, Values) ] ) + }}} This requirement of reduce functions allows CouchDB to store off intermediated reductions directly into inner nodes of btree indexes, and the view index updates and retrievals will have logarithmic cost. It also allows the indexes to be spread across machines and reduced at query time with logarithmic cost.
[Couchdb Wiki] Update of "Development" by BrianCandler
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by BrianCandler: http://wiki.apache.org/couchdb/Development The comment on the change is: Add link to implementation document -- === Getting Started === * ["Running Couchdb in Dev Mode"] * ["How to contribute (for Non-Committers)"] + * [http://horicky.blogspot.com/2008/10/couchdb-implementation.html Implementation overview]
[Couchdb Wiki] Update of "Introduction to CouchDB views" by BrianCandler
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by BrianCandler: http://wiki.apache.org/couchdb/Introduction_to_CouchDB_views -- For more details see [http://damienkatz.net/2008/02/incremental_map.html this blog post] + In addition: reduce functions should not grow its output larger than log(n) where n is the number of input rows. ''(Reference needed)'' +
[Couchdb Wiki] Update of "Introduction to CouchDB views" by BrianCandler
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by BrianCandler: http://wiki.apache.org/couchdb/Introduction_to_CouchDB_views The comment on the change is: Add some notes about group and group_level -- See HttpViewApi to learn how to work with views. ["View_Snippets"] contain a few examples. + == Grouping == + + The output of the map function is precomputed and stored on disk in a B-tree. However for now, the output of the reduce function is calculated 'on demand' from this stored data, rather than being stored itself. + + The basic reduce operation with group=false (the default over HTTP) is to reduce to a single value. But by using startkey and endkey, you can get the summary value for any key interval. + + Using group=true (which is Futon's default), you get a separate reduce value for each unique key in the map - that is, all values which share the same key are grouped together and reduced to a single value. + + group_level=N queries are essentially a macro, which run one normal (group=false) reduce query automatically for each interval on a set of intervals as defined by the level. + + So with group_level=1, and keys like + {{{ + ["a",1,1] + ["a",3,4] + ["a",3,8] + ["b",2,6] + ["b",2,6] + ["c",1,5] + ["c",4,2] + }}} + CouchDB will internally run 3 reduce queries for you. One that reduces + all rows where the first element of the key = "a", one for "b", and + one for "c". + + If you were to query with group_level=2, you'd get a reduce query run + for each unique set of keys (according to their first two elements), + eg + {{{ + ["a",1], ["a",3], ["b",2"], ["c",1], ["c",4] + }}} + + group=true is the conceptual equivalent of group_level=exact, so + CouchDB runs a reduce per unique key in the map row set. + == Restrictions on map and reduce functions == The restriction on map functions is that they must be referentially transparent. That is, given the same input document, they will always emit the same key/value pairs. This allows CouchDB views to be updated incrementally, only reindexing the documents that have changed since the last index update.
[Couchdb Wiki] Update of "Introduction to CouchDB views" by BrianCandler
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by BrianCandler: http://wiki.apache.org/couchdb/Introduction_to_CouchDB_views The comment on the change is: Clarify behaviour of reduce queries across ranges of keys -- See HttpViewApi to learn how to work with views. ["View_Snippets"] contain a few examples. == Grouping == - - The output of the map function is precomputed and stored on disk in a B-tree. However for now, the output of the reduce function is calculated 'on demand' from this stored data, rather than being stored itself. The basic reduce operation with group=false (the default over HTTP) is to reduce to a single value. But by using startkey and endkey, you can get the summary value for any key interval. @@ -176, +174 @@ group=true is the conceptual equivalent of group_level=exact, so CouchDB runs a reduce per unique key in the map row set. + Note: map and reduce results are precomputed and stored in a btree. + However, the intermediate reduction values are cached + according to the btree structure, instead of according to the query + params. So unless your range happens to match exactly the keys + underneath a given inner node, you'll end up running at least one + javascript reduction per reduce query. A group=true query effectively + runs multiple reduce queries, so you may find it to be slower than + you expect. + + There is more detail in [http://horicky.blogspot.com/2008/10/couchdb-implementation.html this blog posting] + under the heading "Query Processing" + == Restrictions on map and reduce functions == The restriction on map functions is that they must be referentially transparent. That is, given the same input document, they will always emit the same key/value pairs. This allows CouchDB views to be updated incrementally, only reindexing the documents that have changed since the last index update.
[Couchdb Wiki] Trivial Update of "ExternalProcesses" by PaulDavis
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by PaulDavis: http://wiki.apache.org/couchdb/ExternalProcesses The comment on the change is: Added the note about simplejson vs. json in 2.6 -- #! /usr/bin/env python import sys - import simplejson + + try: + # Python 2.6 + import json + except: + # Prior to 2.6 requires simplejson + import simplejson as json def requests(): - # `for line in sys.stdin` won't work here + # 'for line in sys.stdin' won't work here line = sys.stdin.readline() while line: yield simplejson.loads(line)
[Couchdb Wiki] Trivial Update of "ExternalProcesses" by PaulDavis
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by PaulDavis: http://wiki.apache.org/couchdb/ExternalProcesses The comment on the change is: Definitely forgot to s/simplejson/json/ in the rest of the code. -- # 'for line in sys.stdin' won't work here line = sys.stdin.readline() while line: - yield simplejson.loads(line) + yield json.loads(line) line = sys.stdin.readline() def respond(code=200, data={}, headers={}): - sys.stdout.write("%s\n" % simplejson.dumps({"code": code, "json": data, "headers": headers})) + sys.stdout.write("%s\n" % json.dumps({"code": code, "json": data, "headers": headers})) sys.stdout.flush() def main():
[Couchdb Wiki] Update of "Related Projects" by GeorgePalmer
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by GeorgePalmer: http://wiki.apache.org/couchdb/Related_Projects The comment on the change is: Add CouchFoo ruby library -- == Libraries == - * [http://couchobject.rubyforge.org/ CouchObject (Ruby client + JsServer for views in Ruby)] * [http://code.google.com/p/couchdb4j/ CouchDB4J Java bindings] * [http://code.google.com/p/erlcouch/ Erlang interface to CouchDB] * Erlang interfaces: @@ -27, +26 @@ * PHP libraries * [http://kore-nordmann.de/projects/phpillow/index.html PHPillow], an object orientated wrapper for CouchDB. * [http://svn.pollinimini.net/couchphp/trunk/ PHP library for CouchDb] + * Ruby libraries + * [http://github.com/georgepalmer/couch_foo CouchFoo (ActiveRecord matching API to CouchDB)] + * [http://couchobject.rubyforge.org/ CouchObject (Ruby client + JsServer for views in Ruby)] * [http://code.google.com/p/couchdb-python/ CouchDB Python Library] * [http://common-lisp.net/project/clouchdb/ CouchDB Common Lisp Library] * [http://jquery.com/plugins/project/jqcouch jQuery CouchDB Library]
[Couchdb Wiki] Update of "Cl-Couch" by RyszardSzopa
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by RyszardSzopa: http://wiki.apache.org/couchdb/Cl-Couch The comment on the change is: typo corrected -- A Lisp image that with a running view server will be listening to port 5477. So, you need to add something like {{{ - common-lisp=/usr/bin/socat -TCP4:localhost:5477 + common-lisp=/usr/bin/socat - TCP4:localhost:5477 }}} to the {{{[Couch Query Servers]}}} section of your {{{couch.ini}}} (you can substitute socat for any program that will allow a
[Couchdb Wiki] Update of "Installing on Windows" by rloh
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by rloh: http://wiki.apache.org/couchdb/Installing_on_Windows The comment on the change is: Makefile had couchdb compiling to its own bin directory; should've been to ebin -- Add the following content: {{{ - {'./couchdb/*', [{outdir,"../bin"}]}. + {'./couchdb/*', [{outdir,"../ebin"}]}. {'./mochiweb/*', [{outdir,"../../mochiweb-0.01/ebin"}]}. }}}
[Couchdb Wiki] Update of "HTTP Document API" by mdornseif
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by mdornseif: http://wiki.apache.org/couchdb/HTTP_Document_API The comment on the change is: rename count to limit -- } }}} - The query string parameters ''startkey'', ''endkey'' and ''count'' may also be used to limit the result set. For example: + The query string parameters ''startkey'', ''endkey'' and ''limit'' may also be used to limit the result set. For example: {{{ - GET somedatabase/_all_docs?startkey=doc2&count=2 HTTP/1.0 + GET somedatabase/_all_docs?startkey=doc2&limit=2 HTTP/1.0 }}} Will return: @@ -138, +138 @@ Both approaches can be combined with ''descending'': {{{ - GET somedatabase/_all_docs?startkey=doc2&count=2&descending=true HTTP/1.0 + GET somedatabase/_all_docs?startkey=doc2&limit=2&descending=true HTTP/1.0 }}} Will return: @@ -297, +297 @@ === POST === - The ''POST'' operation can be used to create a new document with a server generated DocID. To create a named document, use the ''PUT'' method instead. It is recommended that you avoid ''POST'' when possible, because proxies and other network intermediaries will occasionally resend ''POST'' requests, which can result in duplicate document creation. If your client software is not capable of guaranteeing uniqueness of generated UUIDs, use a ''POST'' to ''/_uuids?count=100'' to retrieve a list of document IDs for future ''PUT'' requests. Please note that the ''/_uuids''-call does not check for existing document ids; collision-detection happens when you are trying to save a document. + The ''POST'' operation can be used to create a new document with a server generated DocID. To create a named document, use the ''PUT'' method instead. It is recommended that you avoid ''POST'' when possible, because proxies and other network intermediaries will occasionally resend ''POST'' requests, which can result in duplicate document creation. If your client software is not capable of guaranteeing uniqueness of generated UUIDs, use a ''POST'' to ''/_uuids?limit=100'' to retrieve a list of document IDs for future ''PUT'' requests. Please note that the ''/_uuids''-call does not check for existing document ids; collision-detection happens when you are trying to save a document. The following is an example HTTP ''POST''. It will cause the CouchDB server to generate a new DocID and revision ID and save the document with it.
[Couchdb Wiki] Update of "HTTP Document API" by BobDionne
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by BobDionne: http://wiki.apache.org/couchdb/HTTP_Document_API The comment on the change is: minor change in update doc -- Content-Type: application/json Connection: close - {"ok":true, "id":"some_doc_id", "rev":"946B7D1C"} + {"ok":true, "id":"some_doc_id", "rev":"2774761002"} }}} And here is the server's response if there is an update conflict (what is currently stored in the database is not revision ''946B7D1C'' of document ''some_doc_id'').
[Couchdb Wiki] Update of "View server" by JanLehnardt
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by JanLehnardt: http://wiki.apache.org/couchdb/View_server The comment on the change is: update to 0.9 -- {{{ [query_servers] - - text/javascript=/usr/local/bin/couchjs -f /usr/local/share/couchdb/server/main.js + javascript=/usr/local/bin/couchjs -f /usr/local/share/couchdb/server/main.js - text/ruby=/wherever/couchobject/bin/couch_ruby_view_requestor + ruby=/wherever/couchobject/bin/couch_ruby_view_requestor }}} == Basic API ==
[Couchdb Wiki] Trivial Update of "View server" by PaulDavis
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by PaulDavis: http://wiki.apache.org/couchdb/View_server The comment on the change is: Missed a s/text\/javascript/javascript/ -- == The View Server == - CouchDB delegates computation of ["Views"] to external query servers. It communicates with them over standard input/output, using a very simple, line-based protocol. The default query server is written in Javascript, running via Mozilla !SpiderMonkey. You can use other languages by setting a MIME type in the ''language'' property of a design document or the Content-Type header of a temporary view. Design documents that do not specify a ''language'' property are assumed to be of type ''text/javascript'', as are ad hoc queries that are ''POST''ed to ''_slow_view'' without a ''Content-Type'' header. + CouchDB delegates computation of ["Views"] to external query servers. It communicates with them over standard input/output, using a very simple, line-based protocol. The default query server is written in Javascript, running via Mozilla !SpiderMonkey. You can use other languages by setting a MIME type in the ''language'' property of a design document or the Content-Type header of a temporary view. Design documents that do not specify a ''language'' property are assumed to be of type ''javascript'', as are ad hoc queries that are ''POST''ed to ''_slow_view'' without a ''Content-Type'' header. To register query servers with CouchDB, add a line for each server to ''couch.ini''. The basic syntax is:
[Couchdb Wiki] Update of "Cl-Couch" by FelipeDelgado
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by FelipeDelgado: http://wiki.apache.org/couchdb/Cl-Couch The comment on the change is: Added info about multi-ini file changes to CouchDB 0.9.0 -- }}} to the {{{[Couch Query Servers]}}} section of your {{{couch.ini}}} (you can substitute socat for any program that will allow a - socket open on port 5477 look like a program with standard input and standard output). + socket open on port 5477 look like a program with standard input and standard output). + + '''Update: ''' As of CouchDB 0.9.0, the configuration file has been replaced with a combination of {{{default.ini}}} and {{{local.ini}}}. The line above needs to be added to the {{{local.ini}}} file under the {{{[query_servers]}}} section instead. Restart the CouchDB server and make sure common-lisp is listed next to the query_servers field in the configuration page in Futon. From the Lisp Side
[Couchdb Wiki] Update of "HTTP Document API" by JanLehnardt
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by JanLehnardt: http://wiki.apache.org/couchdb/HTTP_Document_API The comment on the change is: add note about standalone attachment API being added in 0.9. -- === Standalone Attachments === + + Note: This was added in version 0.9 of CouchDB. It is not available in earlier version. + CouchDB allows to create, change and delete attachments without touching the actual document. As a bonus feature, you do not have to base64 encode your data. This can significantly speed up requests since CouchDB and your client do not have to do the base64 conversion. You need to specify a MIME type using the Content-Type header. CouchDB will serve the attachment with the specified Content-Type when asked.
[Couchdb Wiki] Update of "FrontPage" by damien
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by damien: http://wiki.apache.org/couchdb/FrontPage -- == Community == - * #couchdb - CouchDB IRC channel on freenode - * ["Mailing lists"] + * ["Mailing lists"] - The place for CouchDB community support and where the developers discuss and make decisions about the future of CouchDB. + * #couchdb - CouchDB IRC channel on freenode for community support and friendly chat. Note: IRC discussions tend to exclude large parts of the community. Therefore CouchDB core technical discussions and decisions ''must'' take place on the mailing lists, not IRC. They don't count otherwise. * ["People on the Couch"] * ["CouchDB in the wild"] * ["Presentations"]
[Couchdb Wiki] Update of "FrontPage" by damien
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by damien: http://wiki.apache.org/couchdb/FrontPage The comment on the change is: Change "mailing lists" link to point to the permanant ML page on project site. -- == Community == - * ["Mailing lists"] - The place for CouchDB community support and where the developers discuss and make decisions about the future of CouchDB. + * [http://couchdb.apache.org/community/lists.html Mailing lists] - The place for CouchDB community support and where the developers discuss and make decisions about the future of CouchDB. * #couchdb - CouchDB IRC channel on freenode for community support and friendly chat. Note: IRC discussions tend to exclude large parts of the community. Therefore CouchDB core technical discussions and decisions ''must'' take place on the mailing lists, not IRC. They don't count otherwise. * ["People on the Couch"] * ["CouchDB in the wild"]
[Couchdb Wiki] Update of "Getting started with C" by JanLehnardt
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by JanLehnardt: http://wiki.apache.org/couchdb/Getting_started_with_C -- ## page was renamed from GettingStartedWithC + + + This one is horribly out of date. Don't read it. If you need a C API, you've got to write one. Then update this page accordingly, thanks :) + + + Getting started with C and the CouchDB API. == Startup ==
[Couchdb Wiki] Update of "People on the Couch" by EdwardBenson
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by EdwardBenson: http://wiki.apache.org/couchdb/People_on_the_Couch -- * [[MailTo(m...@pobox.com)]], [http://mml.name/ Homepage], [http://twitter.com/mml Twitter] * Ryan Funduk (thenduks) * [http://ryanfunduk.com Blog] + * Edward Benson (eob) + * [[MailTo(e...@csail.mit.edu)]], [http://people.csail.mit.edu/eob/ Homepage], [http://twitter.com/edwardbenson Twitter] + == UTC-3 ==
[Couchdb Wiki] Update of "Getting started with Perl" by MichaelHendricks
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by MichaelHendricks: http://wiki.apache.org/couchdb/Getting_started_with_Perl The comment on the change is: point to the new Net::CouchDB page -- Getting started with Perl and the CouchDB API. - The following shows the basics of working with the raw CouchDB REST api from Perl. If you want a richer interface that more tightly maps Couch documents into Perl (so you don't have to deal with JSON manually, for example), you should pick your favourite out of the several implementations: [http://search.cpan.org/dist/Net-CouchDb/ Net::CouchDb] (See also [http://git.ndrix.com/?p=Net-CouchDB Michael Hendricks' version]), [http://search.cpan.org/dist/CouchDB-Client/ CouchDB::Client], [http://search.cpan.org/dist/AnyEvent-CouchDB/ AnyEvent::CouchDB], [http://search.cpan.org/~zaphar/DB-CouchDB-Schema-0.2.1/lib/DB/CouchDB/Schema.pm DB::CouchDB::Schema], or for POE lovers [http://search.cpan.org/dist/POE-Component-Client-CouchDB/ POE::Component::Client::CouchDB]. + The following shows the basics of working with the raw CouchDB REST api from Perl. If you want a richer interface that more tightly maps Couch documents into Perl (so you don't have to deal with JSON manually, for example), you should pick your favourite out of the several implementations: [http://wiki.github.com/mndrix/net-couchdb Net::CouchDB], [http://search.cpan.org/dist/CouchDB-Client/ CouchDB::Client], [http://search.cpan.org/dist/AnyEvent-CouchDB/ AnyEvent::CouchDB], [http://search.cpan.org/~zaphar/DB-CouchDB-Schema-0.2.1/lib/DB/CouchDB/Schema.pm DB::CouchDB::Schema], or for POE lovers [http://search.cpan.org/dist/POE-Component-Client-CouchDB/ POE::Component::Client::CouchDB]. Note that these examples all use the new version of CouchDB, with a JSON interface rather than XML.
[Couchdb Wiki] Update of "People on the Couch" by DanielTsadok
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by DanielTsadok: http://wiki.apache.org/couchdb/People_on_the_Couch The comment on the change is: added myself -- * [http://ryanfunduk.com Blog] * Edward Benson (eob) * [[MailTo(e...@csail.mit.edu)]], [http://people.csail.mit.edu/eob/ Homepage], [http://twitter.com/edwardbenson Twitter] + * Daniel Tsadok (dtsadok) + * [http://danieltsadok.net/ Homepage] == UTC-3 ==
[Couchdb Wiki] Update of "CouchDB in the wild" by StefanSaasen
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by StefanSaasen: http://wiki.apache.org/couchdb/CouchDB_in_the_wild -- * [http://www.moostrax.com MoosTrax], Web Based GPS Tracking * [http://peasized.net/ Pea Sized], a simple band web site * [http://iwantmyname.com/ iWantMyName], an easy to use domain registrar (finally) - * [http://coravy.com/ coravy. website], corporate website using a non-cms build with CouchDB. + * [http://coravy.com/ coravy. website], corporate website using a non-cms built with CouchDB. * [http://www.pcapr.net/ pcapr], a packet capture sharing, viewing, editing website. == Facebook Applications ==
[Couchdb Wiki] Update of "People on the Couch" by StephaneAlnet
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by StephaneAlnet: http://wiki.apache.org/couchdb/People_on_the_Couch -- * Ben Atkin (benatkin) * [[MailTo(b...@benatkin.com)]], [http://benatkin.com/, Blog] + + == UTC-6 == + + * Stéphane Alnet + * [[MailTo(steph...@shimaore.net)]], [http://blog.shimaore.net/ Blog] == UTC-5 (-4) ==
[Couchdb Wiki] Update of "CouchDB in the wild" by StephaneAlnet
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by StephaneAlnet: http://wiki.apache.org/couchdb/CouchDB_in_the_wild -- == Internal Use == * [http://cybernetics.hudora.biz/ HUDORA] is using it for an internal Track & Trace application [http://blogs.23.nu/c0re/2008/12/building-a-track-and-trace-application-with-couchdb/ more]. + * [http://sotelips.net/ Sotel IP Services] is using it for some dynamic call routing applications [http://blog.shimaore.net/2009/01/freeswitch-modxmlcurl-yaws-erlang-and.html more].
[Couchdb Wiki] Update of "CouchDB in the wild" by JanLehnardt
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by JanLehnardt: http://wiki.apache.org/couchdb/CouchDB_in_the_wild The comment on the change is: add lots of words -- * [http://iwantmyname.com/ iWantMyName], an easy to use domain registrar (finally) * [http://coravy.com/ coravy. website], corporate website using a non-cms built with CouchDB. * [http://www.pcapr.net/ pcapr], a packet capture sharing, viewing, editing website. + * [http://lotsofwords.com/ LotsOfWords], a wikipedia-based term translation service. [http://www.lixo.org/archives/2008/11/02/announcing-lotsofwordscom/ Case Study]. == Facebook Applications == * [http://apps.facebook.com/ukissme/ Will you Kissme], Dating game
[Couchdb Wiki] Trivial Update of "Introduction to CouchDB views" by BobDionne
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by BobDionne: http://wiki.apache.org/couchdb/Introduction_to_CouchDB_views -- === Access Strategy === - For queries which are not meant to actually condense the amount of information you often can life without a reduce function. A common strategy is to get the data you are interested to select by in into the ''key'' part and then use ''startkey'' and ''endkey'' on the result. + For queries which are not meant to actually condense the amount of information you often can live without a reduce function. A common strategy is to get the data you are interested to select by in into the ''key'' part and then use ''startkey'' and ''endkey'' on the result. == Lookup Views ==
[Couchdb Wiki] Update of "How-To Guides" by WoutMertens
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by WoutMertens: http://wiki.apache.org/couchdb/How-To_Guides The comment on the change is: extra link to proxy setup so it's easier to find -- * ["How to serve applications"] * ["How to store hierarchical data"] * ["How to replicate a database"] + * ["Apache_As_a_Reverse_Proxy"]: How to put CouchDB behind proxy (for access control and/or high availability)
[Couchdb Wiki] Update of "CouchDB in the wild" by SebastienPahl
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by SebastienPahl: http://wiki.apache.org/couchdb/CouchDB_in_the_wild -- * [http://github.com/harryf/urldammit/tree/master urldammit], RESTful "lost+found" service for tracking the state of URLs a site is serving. Supports multiple backends (currently couchdb and mysql for the risk averse) * [http://arbitracker.org Arbit project tracker], aims to provide a decent modern extensible multi project tracking tool. Features start with issue tracking and wiki and will not stop before code analysis and translation management. * [http://github.com/jtulloch/scanty/tree/master Scanty on the Couch], a port of Adam Wiggins' Scanty blog software + * [http://dotcloud.org dotCloud], open-source cloud federation platform == Websites ==
[Couchdb Wiki] Update of "How to store hierarchical data" by PeterMonks
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by PeterMonks: http://wiki.apache.org/couchdb/How_to_store_hierarchical_data The comment on the change is: Attempted to clarify the text concerning UUID / numeric _ids. -- ] }}} - In a real system you'd probably want to use some sort of UUID instead of descriptive strings, since conflicts between node names could be bad. In fact, it'd probably be much faster to just use numbers, since comparisons on numbers are generally much faster. For the purposes of this example, however, it's much easier to understand if it's descriptive text. + In a real system you'd probably want to use some sort of UUID for the _id field rather than descriptive strings, since conflicts between node names could be bad. In fact, it'd probably be much faster to just use numbers, since comparisons on numbers are generally much faster. For the purposes of this example, however, it's much easier to understand if the _id is descriptive text. For the purposes of displaying the path for a particular document, however, it will generally be easier to store (at least) the descriptive name of each path element in the path array, as shown here. Once that data is in your DB, it's time to get it out again!
[Couchdb Wiki] Update of "HTTP Document API" by PeterMonks
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by PeterMonks: http://wiki.apache.org/couchdb/HTTP_Document_API -- === Modify Multiple Documents With a Single Request === - CouchDB provides a bulk insert/update feature. To use this, you make a ''POST'' request to the URI ''/{dbname}/_bulk_docs'', with the request body being a JSON document containing a list of new documents to be inserted or updated. The bulk post is a transactional operation - all updates/insertions succeed, or all fail. + CouchDB provides a bulk insert/update feature. To use this, you make a ''POST'' request to the URI ''/{dbname}/_bulk_docs'', with the request body being a JSON document containing a list of new documents to be inserted or updated. The bulk post is currently (0.8.0) a transactional operation - all updates/insertions succeed, or all fail - but that behaviour may change in future (see http://n2.nabble.com/couchdb-transactions-changes-td2289541.html for more information). Doc formats below are as per CouchDB 0.8.0.
[Couchdb Wiki] Update of "Reference" by ChrisAnderson
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by ChrisAnderson: http://wiki.apache.org/couchdb/Reference The comment on the change is: add link to show and list page -- * ["HTTP status list"] * ["Reserved words"] * ["URI templates"] + * ["Formatting with Show and List"] == Configuration ==
[Couchdb Wiki] Update of "Formatting with Show and List" by ChrisAnderson
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by ChrisAnderson: http://wiki.apache.org/couchdb/Formatting_with_Show_and_List The comment on the change is: documented show functions New page: The basics of formatting documents using `show` and `list` functions. These functions convert documents and views, respectively, into non-JSON formats. The rows of each view are processed individually, which keeps long lists from becoming memory hogs. They are designed to be cacheable. CouchDB handles generating Etags for show and list responses. Show and list functions are side effect free and idempotent. They can not make additional HTTP requests against CouchDB. Their purpose is to render JSON documents in other formats. == Showing Documents == Show functions are stored in your design document, under the `shows` key. Here's an example set of show functions: {{{ { "_id" : "_design/examples", "shows" : { "posts" : "function(doc, req) {... return responseObject;}", "people" : "function(doc, req) { ... }" } }}} These functions could be queried like this: {{{ GET /db/_show/examples/posts/somedocid GET /db/_show/examples/people/otherdocid GET /db/_show/examples/people/otherdocid?format=xml&details=true }}} The show function is run with two arguments, the first is the document corresponding to the requested docid. The second argument is the req object, which contains information about the query string, Accept headers, and other per-request information. The show function returns a JSON object of the same format of the _external response. See ExternalProcesses for further explanation of the `req` object as well as documentation about the response. == Listing Views ==
[Couchdb Wiki] Update of "Formatting with Show and List" by ChrisAnderson
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by ChrisAnderson: http://wiki.apache.org/couchdb/Formatting_with_Show_and_List The comment on the change is: documentation for list funs -- == Listing Views == + List funcitons are stored under the `lists` key of design documents. Here's an example desgin doc with list functions: + + {{{ + { + "_id" : "_design/examples", + "views" { + "posts-by-date" : "function(doc){...}", + "posts-by-tag" : "function(doc){...}", + "people-by-name" : "function(doc) {...}" + }, + "lists" : { + "index-posts" : "function(head, row, req, row_info) {...}", + "browse-people" : "function(head, row, req, row_info) { ... }" + } + }}} + + These lists are run by querying URLs like: + + {{{ + GET /db/_list/examples/index-posts/posts-by-date?descending=true&limit=10 + + GET /db/_list/examples/index-posts/posts-by-tag?key="howto" + + GET /db/_list/examples/browse-people/people-by-name?startkey=["a"]&limit=10 + + }}} + + List functions have a more interesting signature, as they are passed the head of the view on first invocation, then each row in turn, then called once finally for the tail of the view. They also have the ability to abort iteration early, which is handy for some filtering operations. + + Example list function: + + {{{ + function(head, row, req, row_info) { + if (head) { + return "head: "+JSON.stringify(head)+"""; + } else if (row) { + return ""+JSON.stringify(row)+""; + } else { + return "the tail" + } + } + }}} + + Hopefully that gets you enough to get started. For a more complete set of examples, see the CouchDB test suite, especially show_documents.js and list_views.js +
[Couchdb Wiki] Update of "Development" by JanLehnardt
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by JanLehnardt: http://wiki.apache.org/couchdb/Development The comment on the change is: add stats docs -- * ["Open items"] * ["One laptop per child"] * ["Full text search"] + * ["Adding Runtime Statistics"] === Getting Started === * ["Running Couchdb in Dev Mode"]
[Couchdb Wiki] Update of "Adding Runtime Statistics" by JanLehnardt
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by JanLehnardt: http://wiki.apache.org/couchdb/Adding_Runtime_Statistics The comment on the change is: add stats docs New page: = Adding Runtime Statistics = CouchDB (since 0.9) comes with a runtime statistics module ("the stats module") that gathers all sorts of information during the lifetime of a CouchDB instance. This page explains how you can make the stats module collect information; either in new modules or existing ones. == The Collector == The collector does all the real-time counting of stuff. It lives in the `src/couchdb/couch_stats_collector.erl` file. There are three types of counters in the collector === Hit Counter === A hit counter is a monotonically increasing counter that simply counts events. Starting from 0 with now upper boundary. To count events, call {{{ couch_stats_collector:increment({Module, Key}). }}} This registers the counter with the collector and increments it each time this line executed. We'll cover what `{Module, Key}` means in a minute. === Limit Counter === An limit counter is a lot like a hit counter, only that it can go down again. Think number of open databases, or currently running requests. When an event starts, the counter is incremented, when the event is over, decremented. {{{ couch_stats_collector:increment({Module, Key}). }}} {{{ couch_stats_collector:decrement({Module, Key}). }}} === Absolute Value Counter === An absolute value counter is not really a counter, it collects absolute values for one second. They are good for collecting information like the amount of time spent in an event or the size of some piece of data. {{{ couch_stats_collector:record({Module, Key}). }}} == Keys == To uniquely identify a counter, use a tuple of the form `{Module, Key}`. `Module` should be the name of the module where the event takes place. And `Key` should be the name of the counter and must be unique within a module. Look at existing counters to get a feel for the naming. == The Aggregator == The aggregator is a second module that queries the collector module at certain intervals to collect current values and calculate aggregates like min, max, mean and stddev values. Hit and limit counters are just queried for their current value. The aggregator calculates the new aggregate values based on the previous values in constant time. Absolute value counters are queried for their current values and then flushed to avoid running out of memory. The aggregator queries the collector at predefined intervals: Every second, every minute, every five minutes and every fifteen minutes. That way you can quickly see how changes affect CouchDB's performance.
[Couchdb Wiki] Update of "Formatting with Show and List" by JensAlfke
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by JensAlfke: http://wiki.apache.org/couchdb/Formatting_with_Show_and_List The comment on the change is: Cleanup and, hopefully, clarifications -- } }}} - These functions could be queried like this: + Assuming these functions were in a design document named "`examples`" in a database named "`db`", they could be queried like this: {{{ GET /db/_show/examples/posts/somedocid @@ -30, +30 @@ }}} - The show function is run with two arguments, the first is the document corresponding to the requested docid. The second argument is the req object, which contains information about the query string, Accept headers, and other per-request information. + The `show` function is run with two arguments. The first is the document corresponding to the requested `docid`, and the second describes the HTTP request's query string, Accept headers, and other per-request information. The function returns an object describing its HTTP response. - The show function returns a JSON object of the same format of the _external response. See ExternalProcesses for further explanation of the `req` object as well as documentation about the response. + The request and response objects are of the same format used by `_external` functions, as documented in ExternalProcesses. == Listing Views == - List funcitons are stored under the `lists` key of design documents. Here's an example desgin doc with list functions: + List functions are stored under the `lists` key of a design document. Here's an example design doc with list functions, in addition to views: {{{ { @@ -60, +60 @@ GET /db/_list/examples/index-posts/posts-by-tag?key="howto" GET /db/_list/examples/browse-people/people-by-name?startkey=["a"]&limit=10 - }}} - List functions have a more interesting signature, as they are passed the head of the view on first invocation, then each row in turn, then called once finally for the tail of the view. They also have the ability to abort iteration early, which is handy for some filtering operations. + [As above, we assume the database is named "db" and the design doc "examples".] + + A list function has a more interesting signature, as it is passed the head of the view on first invocation, then each row in turn, then called one more time for the tail of the view. The function should check the `head` and `row` parameters to identify which state it's being called in; the sequence of calls to `listfn`, for a view with three rows, would look like: + + {{{ + listfn(true, null , req, null); // Before the first row: head=true + listfn(false, rows[0], req, row_info); // First row: head=false + listfn(false, rows[1], req, row_info); // Subsequent rows... + listfn(false, rows[2], req, row_info); + listfn(false, null,req, row_info); // After last row: row=null + }}} + + List functions also have the ability to abort iteration early, which is handy for some filtering operations. Example list function: @@ -79, +90 @@ } }}} - Hopefully that gets you enough to get started. For a more complete set of examples, see the CouchDB test suite, especially show_documents.js and list_views.js + Hopefully this is enough to get started. For a more complete set of examples, see the CouchDB test suite, especially show_documents.js and list_views.js
[Couchdb Wiki] Update of "URI templates" by JensAlfke
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by JensAlfke: http://wiki.apache.org/couchdb/URI_templates The comment on the change is: Added view, show and list URIs, and some formatting. -- - A handy list of all the key CouchDB [http://bitworking.org/projects/URI-Templates/ URIs templates]. + A handy list of all the key CouchDB [http://bitworking.org/projects/URI-Templates/ URI templates]. + + === Databases and Documents === To see a listing of databases: - http://localhost:5984/_all_dbs + /_all_dbs To see some basic information about a database: - http://localhost:5984/dbname/ + /''dbname''/ To see all a listing of the data documents in a database: - http://localhost:5984/dbname/_all_docs + /''dbname''/_all_docs To see a document: - http://localhost:5984/dbname/docid + /''dbname''/''docid'' To download a file attachment: - http://localhost:5984/dbname/docid/filename + /''dbname''/''docid''/''filename'' + + === Design Documents and Views === To see a design document: - http://localhost:5984/dbname/_design/designdocid + /''dbname''/_design/''designdocid'' + To query a view: + + /''dbname''/_view/''designdocid''/viewname?''query'' + + To query a temporary ("slow") view (with the custom view function in the body of the request): + + /''dbname''/_slow_view?''query'' + + === Formatting === + + To format a document through a "show" template: + + /''dbname''/_show/''designdocid''/''showname''/''docid'' + + To format a view through a "list" template: + + /''dbname''/_list/''designdocid''/''listname''/''viewname''?''query'' + + === View Query Syntax === + + The most common query parameters for accessing views are: + + * ?startkey=''keyvalue'' + * ?endkey=''keyvalue'' + * ?limit=''max rows to return'' + * ?skip=''number of rows to skip'' + + For the full query syntax, see the ["HTTP view API"]. +
[Couchdb Wiki] Update of "Document revisions" by PatrickAntivackis
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by PatrickAntivackis: http://wiki.apache.org/couchdb/Document_revisions -- Due to compaction, revisions may disappear at any time. You cannot use them for a client revision system. + ["Replication"] has also an impact on revisions, i.e. '''Replication only replicates the last version of a document''', so the it will be impossible to access, on the destination database, previous versions of a document that were store on the source database. + If you wish to implement revisions in your client system a number of patterns have been suggested: * Using attachments to store old revisions.
[Couchdb Wiki] Update of "Replication" by PatrickAntivackis
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by PatrickAntivackis: http://wiki.apache.org/couchdb/Replication New page: == Overview == The replication is an incremental one way process involving two databases (a source and a destination). The aim of the replication is that at the end of the process, all active documents on the source database are also in the destination database and all documents that were deleted in the source databases are also deleted (if exists) on the destination database. The replication process only copy the last revision document, so all previous revision that were only on the source database are not copied to the destination database.
[Couchdb Wiki] Update of "Formatting with Show and List" by PaulDavis
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by PaulDavis: http://wiki.apache.org/couchdb/Formatting_with_Show_and_List The comment on the change is: Redirect example -- } }}} + + == Other Fun Things == + + === Stopping iteration in a `_list` === + + If you want to terminate iteration of a `_list` early you can return a `{stop: true}` JSON object from any of the calls to the function that include a row object. + + === Sending a Redirect === + + In the call to `_show` or when `_list` is called with a head object you can control the headers and status code sent to the client. An example of this would be to send a redirect notification. + + {{{ + function(doc) + { + return {"code": 302, "body": "See other", "headers": {"Location": "/"}}; + } + }}} + + {{{ + function(head, row, req, row_info) { + if (head) { + return {"code": 302, "body": "See other", "headers": {"Location": "/"}}; + } else if (row) { + return {stop: true}; + } else { + return "." + } + } + }}} + Hopefully this is enough to get started. For a more complete set of examples, see the CouchDB test suite, especially show_documents.js and list_views.js
[Couchdb Wiki] Update of "Formatting with Show and List" by JensAlfke
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by JensAlfke: http://wiki.apache.org/couchdb/Formatting_with_Show_and_List The comment on the change is: Added details about 'head' and 'row_info'. -- A list function has a more interesting signature, as it is passed the head of the view on first invocation, then each row in turn, then called one more time for the tail of the view. The function should check the `head` and `row` parameters to identify which state it's being called in; the sequence of calls to `listfn`, for a view with three rows, would look like: {{{ - listfn(true, null , req, null); // Before the first row: head=true + listfn(head, null,req, null); // Before the first row: head is non-null - listfn(false, rows[0], req, row_info); // First row: head=false + listfn(null, rows[0], req, row_info); // First row - listfn(false, rows[1], req, row_info); // Subsequent rows... + listfn(null, rows[1], req, row_info); // Subsequent rows... - listfn(false, rows[2], req, row_info); + listfn(null, rows[2], req, row_info); - listfn(false, null,req, row_info); // After last row: row=null + listfn(null, null,req, row_info); // After last row: row=null }}} - List functions also have the ability to abort iteration early, which is handy for some filtering operations. + The `head` parameter -- which is only passed into the first call -- contains an object with information about the view that is to be iterated over. It's much like the response object returned from a view query in the CouchDB JavaScript API; useful properties include `total_rows` and `offset`. + + The `row_info` parameter contains an object with information about the iteration state. Its properties include: + * `row_number` (the current row number) + * `first_key` (the first key of the view to be listed) + * `prev_key` (the key of the row in the previous iteration) Example list function:
[Couchdb Wiki] Trivial Update of "Formatting with Show and List" by JensAlfke
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by JensAlfke: http://wiki.apache.org/couchdb/Formatting_with_Show_and_List The comment on the change is: Oops, fixed list formatting -- The `head` parameter -- which is only passed into the first call -- contains an object with information about the view that is to be iterated over. It's much like the response object returned from a view query in the CouchDB JavaScript API; useful properties include `total_rows` and `offset`. The `row_info` parameter contains an object with information about the iteration state. Its properties include: - * `row_number` (the current row number) + * `row_number` (the current row number) - * `first_key` (the first key of the view to be listed) + * `first_key` (the first key of the view to be listed) - * `prev_key` (the key of the row in the previous iteration) + * `prev_key` (the key of the row in the previous iteration) Example list function: