APPENDIXA251CouchDBAPIReferenceThisappendixisanoverviewoftheAPIcallsyoucanmaketotheCouchDBserver.
ServerAPIsServerInformationRequestMethod:GETRequestURI:/RequestHeaders:NoneRequestBody:EmptyRequestParameters:NoneDescription:ReturnsawelcomemessageandtheCouchDBversionnumberSampleRequestURI:http://127.
0.
0.
1:5984/Thefollowingisasampleresponse:{"couchdb":"Welcome","version":"0.
9.
1"}APPENDIXACOUCHDBAPIREFERENCE252CurrentConfigurationRequestMethod:GETRequestURI:/_configRequestHeaders:NoneRequestBody:EmptyRequestParameters:NoneDescription:ReturnsallofCouchDB'sconfigurationoptionsandtheircurrentvaluesSampleRequestURI:http://127.
0.
0.
1:5984/_configThefollowingisasampleresponse:{"httpd_design_handlers":{"_list":"{couch_httpd_show,handle_view_list_req}","_show":"{couch_httpd_show,handle_doc_show_req}","_view":"{couch_httpd_view,handle_view_req}"},"httpd_global_handlers"couch_httpd_misc_handlers,handle_welcome_req,httpd_misc_handlers,handle_task_status_req}","_all_dbs":"{couch_httpd_misc_handlers,handle_all_dbs_req}","_config":"{couch_httpd_misc_handlers,handle_config_req}","_replicate":"{couch_httpd_misc_handlers,handle_replicate_req}","_restart":"{couch_httpd_misc_handlers,handle_restart_req}","_stats":"{couch_httpd_stats_handlers,handle_stats_req}","_utils":"{couch_httpd_misc_handlers,handle_utils_dir_req,\"/usr/local/share/couchdb/www\"}","_uuids":"{couch_httpd_misc_handlers,handle_uuids_req}","favicon.
ico":"{couch_httpd_misc_handlers,handle_favicon_req,\"/usr/local/share/couchdb/www\"}"},"log":{"file":"/usr/local/var/log/couchdb/couch.
log","level":"info"},"query_servers":{"javascript":"/usr/local/bin/couchjs/usr/local/share/couchdb/server/main.
js"},"daemons":{"db_update_notifier":"{couch_db_update_notifier_sup,start_link,[]}","external_manager":"{couch_external_manager,start_link,[]}","httpd":"{couch_httpd,start_link,[]}","query_servers":"{couch_query_servers,start_link,[]}","stats_aggregator":"{couch_stats_aggregator,start,[]}","stats_collector":"{couch_stats_collector,start,[]}","view_manager":"{couch_view,start_link,httpd":{"WWW-Authenticate":"Basicrealm=\"administrator\"","authentication_handler":"{couch_httpd,default_authentication_handler}","bind_address":"127.
0.
0.
1","port":"5984"},"httpd_db_handlers":{"_design":"{couch_httpd_db,handle_design_req}","_temp_view":"{couch_httpd_view,handle_temp_view_req}"},"test":{"foo":"bar"},"couchdb":{"database_dir":"/usr/local/var/lib/couchdb","max_attachment_chunk_size":"4294967296","max_dbs_open":"100","max_document_size":"4294967296","os_process_timeout":"5000","util_driver_dir":"/usr/local/lib/couchdb/erlang/lib/couch-0.
9.
1/priv/lib","view_index_dir":"/usr/local/var/lib/couchdb"}}APPENDIXACOUCHDBAPIREFERENCE253RuntimeStatisticsRequestMethod:GETRequestURI:/_statsRequestHeaders:NoneRequestBody:EmptyRequestParameters:range(integer,timeperiodforwhichtoretrievestats,default0)Validvalues:0(sincetheserverbooted),60,300,900Description:ReturnsasetofCouchDBruntimestatisticsSampleRequestURI:http://127.
0.
0.
1:5984/_statsThefollowingisasampleresponse:{"httpd_status_codes":{"200":{"current":152,"count":9466,"mean":0.
016057468835833463,"min":0,"max":22,"stddev":0.
2956761553416581,"description":"numberofHTTP200OKresponses"},"201":{"current":78,"count":9465,"mean":0.
0082408874801902,"min":0,"max":21,"stddev":0.
25164166969889457,"description":"numberofHTTP201Createdresponses"},"202":{"current":2,"count":9414,"mean":0.
00021244954323348223,"min":0,"max":1,"stddev":0.
0145741006043276,"description":"numberofHTTP202Acceptedresponses"},"304":{"current":1,"count":9414,"mean":0.
00010622477161674126,"min":0,"max":1,"stddev":0.
0103059928155727,"description":"numberofHTTP304NotModifiedresponses"},"400":{"current":1,"count":2416,"mean":0.
0004139072847682145,"min":0,"max":1,"stddev":0.
02034050062136692,"description":"numberofHTTP400BadRequestresponses"},"404":{"current":12,"count":9465,"mean":0.
001267828843106181,"min":0,"max":6,"stddev":0.
06660175343709973,"description":"numberofHTTP404NotFoundresponses"},"405":{"current":2,"count":9442,"mean":0.
00021181952976064448,"min":0,"max":1,"stddev":0.
014552479591033817,"description":"numberofHTTP405MethodNotAllowedresponses"},"409":{"current":1,"count":595,"mean":0.
0016806722689075649,"min":0,"max":1,"stddev":0.
0409615381746351,"description":"numberofHTTP409Conflictresponses"},"500":{"current":1,"count":4887,"mean":0.
00020462451401678002,"min":0,"max":1,"stddev":0.
014303238892818738,"description":"numberofHTTP500InternalServerErrorresponses"}},"httpd_request_methods":{"COPY":{"current":2,"count":9432,"mean":0.
00021204410517387668,"min":0,"max":1,"stddev":0.
01456019033087608,"description":"numberofHTTPCOPYrequests"},"DELETE":{"current":42,"count":9465,"mean":0.
00443740095087166,"min":0,"max":6,"stddev":0.
10472898092881516,"description":"numberofHTTPDELETErequests"},"GET":{"current":113,"count":9466,"mean":0.
011937460384534125,"min":0,"max":21,"stddev":0.
24915896286993675,"description":"numberofHTTPGETrequests"},"POST":{"current":14,"count":9450,"mean":0.
0014814814814814847,"min":0,"max":3,"sAPPENDIXACOUCHDBAPIREFERENCE254tddev":0.
04598051031711314,"description":"numberofHTTPPOSTrequests"},"PUT":{"current":78,"count":9466,"mean":0.
008240016902598794,"min":0,"max":22,"stddev":0.
26029556220645184,"description":"numberofHTTPPUTrequests"}},"httpd":{"bulk_requests":{"current":1,"count":9430,"mean":0.
00010604453870625688,"min":0,"max":1,"stddev":0.
010297246877785696,"description":"numberofbulkrequests"},"requests":{"current":250,"count":9466,"mean":0.
02641031058525249,"min":0,"max":32,"stddev":0.
5274422956827197,"description":"numberofHTTPrequests"},"temporary_view_reads":{"current":2,"count":9450,"mean":0.
0002116402116402122,"min":0,"max":1,"stddev":0.
014546319811589058,"description":"numberoftemporaryviewreads"},"view_reads":{"current":2,"count":9454,"mean":0.
00021155066638459967,"min":0,"max":1,"stddev":0.
014543242853646884,"description":"numberofviewreads"}},"couchdb":{"database_reads":{"current":42,"count":9460,"mean":0.
004439746300211437,"min":0,"max":10,"stddev":0.
1446047067385059,"description":"numberoftimesadocumentwasreadfromadatabase"},"database_writes":{"current":66,"count":9461,"mean":0.
0069760067646126005,"min":0,"max":22,"stddev":0.
27500988894664896,"description":"numberoftimesadatabasewaschanged"},"open_databases":{"current":3,"count":9465,"mean":0.
0003169572107765436,"min":-5,"max":5,"stddev":0.
0815843181281427,"description":"numberofopendatabases"},"open_os_files":{"current":3,"count":9465,"mean":0.
0003169572107765436,"min":-5,"max":5,"stddev":0.
08660958488049343,"description":"numberoffiledescriptorsCouchDBhasopen"},"request_time":{"current":2,"count":250,"mean":6.
872,"min":0,"max":1093,"stddev":68.
90938699480645,"description":"lengthofarequestinsideCouchDBwithoutMochiWeb"}}}APPENDIXACOUCHDBAPIREFERENCE255GetUUIDsRequestMethod:GETRequestURI:/_uuidsRequestHeaders:NoneRequestBody:EmptyRequestParameters:count(integer,thenumberofUUIDstoreturn,default1)Description:ReturnsalistofUUIDsSampleRequestURI:http://127.
0.
0.
1:5984/_uuidscount=3Thefollowingisasampleresponse:{"uuids":["1beb354da53d6581efb552fd18d30694","e5b2e7d2866af47d114676fb8fc813b","d2cac24e8b221a8f2481ce6990731e71"]}APPENDIXACOUCHDBAPIREFERENCE256DatabaseAPIsCreateDatabaseRequestMethod:PUTRequestURI:/[db_name]RequestHeaders:NoneRequestBody:EmptyRequestParameters:NoneDescription:CreatesanewdatabaseSampleRequestURI:http://127.
0.
0.
1:5984/employeesThefollowingisasampleresponse:{"ok":true}APPENDIXACOUCHDBAPIREFERENCE257DeleteDatabaseRequestMethod:DELETERequestURI:/[db_name]RequestHeaders:NoneRequestBody:EmptyRequestParameters:NoneDescription:Deletes(drops)anexistingdatabaseSampleRequestURI:http://127.
0.
0.
1:5984/employeesThefollowingisasampleresponse:{"ok":true}APPENDIXACOUCHDBAPIREFERENCE258ListDatabasesRequestMethod:GETRequestUURI:/_all_dbsRequestHeaders:NoneRequestBody:EmptyRequestPParameters:NoneDescription:ReturnsanarraywiththenamesofalldatabasesontheserverSampleRequestURI:http://127.
0.
0.
1:5984/_all_dbsThefollowingisasampleresponse:["my_db","employees","contacts","customers"]APPENDIXACOUCHDBAPIREFERENCE259DatabaseInformationRequestMethod:GETRequestURI:/[db_name]RequestHeaders:NoneRequestBody:EmptyRequestParameters:NoneDescription:ReturnsbasicinformationaboutaCouchDBdatabaseSampleRequestURI:http://127.
0.
0.
1:5984/employeesThefollowingisasampleresponse:{"db_name":"employees","doc_count":125,"doc_del_count":3,"update_seq":190,"purge_seq":10,"compact_running":false,"disk_size":192847,"instance_start_time":"1254437520141551"}APPENDIXACOUCHDBAPIREFERENCE260ReplicateDatabaseRequestMethod:POSTRequestUURI:/_replicateRequestHeaders:NoneRequestBody:JSONobjectwithtwofields,sourceandtarget,eachrepresentedbyadatabasename(iflocal)ortheURL(ifremote)RequestPParameters:NoneDescription:ReplicatesasourcedatabasetoatargetdatabaseSampleRequestURI:http://127.
0.
0.
1:5984/_replicateThefollowingisasampleresponse:{"ok":true,"session_id":"95896d0cb2f59ae4b5717f128300697","source_last_seq":1,"history":[{"start_time":"Thu,01Oct200922:45:29GMT","end_time":"Thu,Oct01200922:45:29GMT","start_last_seq":0,"end_last_seq":1,"missing_checked":1,"missing_found":1,"docs_read":1,"docs_written":1,"doc_write_failures":0}]}APPENDIXACOUCHDBAPIREFERENCE261CompactDatabaseRequestMethod:POSTRequestURI:/[db_name]/_compactRequestHeaders:NoneRequestBody:EmptyRequestParameters:NoneDescription:DeletesdocumentsmarkedasdeletedandoldrevisionsofdocumentsSampleRequestURI:http://127.
0.
0.
1:5984/employees/_compactThefollowingisasampleresponse:{"ok":true}APPENDIXACOUCHDBAPIREFERENCE262DocumentAPIsCreateNewDocument(UseUUID-GeneratedDocumentID)RequestMethod:POSTRequestURI:/[db_name]RequestHeaders:NoneRequestBody:ThedocumentitselfasaJSONobjectRequestParameters:NoneDescription:Createsanewdocumentinthedatabase,withthedocumentIDautomaticallygeneratedbytheserverSampleRequestURI:http://127.
0.
0.
1:5984/employeesThefollowingisasampleresponse:{"ok":true,"id":"89107b443aadb405dc871efbec5073ad","rev":"1-2286301188"}APPENDIXACOUCHDBAPIREFERENCE263CreateNewDocument(UserSpecifiedDocumentID)RequestMethod:PUTRequestURI:/[db_name]/[doc_id]RequestHeaders:NoneRequestBody:ThedocumentasaJSONobjectRequestParameters:NoneDescription:Createsanewdocumentinthedatabase,withthespecifieddocumentIDSampleRequestURI:http://127.
0.
0.
1:5984/employees/126Thefollowingisasampleresponse:{"ok":true,"id":"126","rev":"1-2833850875"}APPENDIXACOUCHDBAPIREFERENCE264UpdateExistingDocumentRequestMethod:PUTRequestURI:/[db_name]/[doc_id]RequestHeaders:X-Couch-Full-Commit:true(optional).
Ensurethatthedocumenthassyncedtodiskbeforereturningsuccess.
RequestBody:ThedocumentitselfasaJSONobject.
Itmustincludethe_revproperty,withtherevisionnumberofthedocumenttheupdateisbasedonasthevalue.
RequestParameters:NoneDescription:UpdatesanexistingdocumentandreplacesitwithanewrevisionSampleRequestURI:http://127.
0.
0.
1:5984/employees/126Thefollowingisasampleresponse:{"ok":true,"id":126","rev":"2-4058198378"}APPENDIXACOUCHDBAPIREFERENCE265DeleteDocumentRequestMethod:DELETERequestURI:/[db_name]/[doc_id]RequestHeaders:NoneRequestBody:EmptyRequestParameters:rev(String,required,revisionnumberofdocumenttobedeleted)Description:Deletesadocumentfromthedatabasebycreatinganewrevisionofthedocument,whichismarkedasdeleted.
Thedocumentwillberemovedpermanentlyfromthedatabasethenexttimeitiscompacted.
SampleRequestURI:http://127.
0.
0.
1:5984/employees/126Thefollowingisasampleresponse:{"ok":true,"id":"126","3-2206761782"}APPENDIXACOUCHDBAPIREFERENCE266CopyDocumentRequestMethod:COPYRequestURI:/[db_name]/[doc_id]RequestHeaders:Destination:[destination_doc_id]RequestBody:EmptyRequestParameters:NoneDescription:CopiesadocumenttothedocumentIDspecifiedinthedestinationheader.
Ifoverwritinganexistingdocument,youneedtospecifytherevisionbeingoverwrittenusingtherevparameterintheDestinationheader(suchasDestination:126rev=2-345345345345).
SampleRequestURI:http://127.
0.
0.
1:5984/employees/126Thefollowingisasampleresponse:{"rev":"1-1950429145"}APPENDIXACOUCHDBAPIREFERENCE267ListDocumentsRequestMethod:GETRequestURI:/[db_name]/_all_docsRequestHeaders:NoneRequestBody:EmptyRequestParameters:descending(Boolean,reversesorderofresults,defaultfalse)include_docs(Boolean,includefulldocument,defaultfalse)limit(Number,restrictnumberofresults)startkey(String,startkeytoreturndocumentsinarange)endkey(String,endkeytoreturndocumentsinarange)startkey_docid(String,startdocumentIDofrange)endkey_docid(String,enddocumentIDofrange)key(String,onlydisplaydocumentthatmatcheskey)stale(String=ok,don'trefreshviewsforquickerresults)skip(Number,skipthedefinednumberofdocuments)group(Boolean,resultsshouldbegrouped,defaultfalse)group_level(Number,oevelatwhichdocumentsshouldbegrouped)reduce(Boolean;ifexists,displayresultofreducefunction;defaulttrue)Description:ReturnseverydocumentinadatabaseSampleRequestURI:http://127.
0.
0.
1:5984/employees/_all_docsThefollowingisasampleresponse:{"total_rows":125,"offset":0,"rows":[{"id":"001","key":"001","value":{"rev":"1-4228106699"}},…{"id:"125","key":"125","value":{"rev":"2-3453483473}}]}APPENDIXACOUCHDBAPIREFERENCE268ListDocumentsSpecifyingaKeySetRequestMethod:GETRequestURI:/[db_name]/_all_docsRequestHeaders:NoneRequestBody:{"keys":["docid1","docid2",.
.
.
,"docidN"]}RequestParameters:descending(Boolean,reversesorderofresults,defaultfalse)include_docs(Boolean,includefulldocument,defaultfalse)limit(Number,restrictnumberofresults)startkey(String,startkeytoreturndocumentsinarange)endkey(String,endkeytoreturndocumentsinarange)startkey_docid(String,startdocumentIDofrange)endkey_docid(String,enddocumentIDofrange)key(String,onlydisplaydocumentthatmatcheskey)stale(String=ok,don'trefreshviewsforquickerresults)skip(Number,skipthedefinednumberofdocuments)group(Boolean,resultsshouldbegrouped,defaultfalse)group_level(Number,levelatwhichdocumentsshouldbegrouped)reduce(Boolean;ifexists,displayresultofreducefunction;defaulttrue)Description:ReturnseverydocumentinadatabaseSampleRequestURI:http://127.
0.
0.
1:5984/employees/_all_docsThefollowingisasampleresponse:{"total_rows":125,"offset":0,"rows":[{"id":"docid1","key":"001","value":{"rev":"1-4228106699"}},{"id":"125","key":"125","value":{"rev":"2-3453483473}},.
.
.
]}APPENDIXACOUCHDBAPIREFERENCE269ListModifiedDocumentsRequestMethod:GETRequestURI:/[db_name]/_all_docs_by_seqRequestHeaders:NoneRequestBody:EmptyRequestParameters:descending(Boolean,reversesorderofresults,defaultfalse)include_docs(Boolean,includefulldocument,defaultfalse)limit(Number,restrictnumberofresults)startkey(String,startkeytoreturndocumentsinarange)endkey(String,endkeytoreturndocumentsinarange)startkey_docid(String,startdocumentIDofrange)endkey_docid(String,enddocumentIDofrange)key(String,onlydisplaydocumentthatmatcheskey)stale(String=ok,don'trefreshviewsforquickerresults)skip(Number,skipthedefinednumberofdocuments)group(Boolean,resultsshouldbegrouped,defaultfalse)group_level(Number,levelatwhichdocumentsshouldbegrouped)reduce(Boolean;ifexists,displayresultofreducefunction;defaulttrue)Description:ReturnsdocumentsthathavebeenupdatedordeletedSampleRequestURI:http://127.
0.
0.
1:5984/employees/_all_docs_by_seqThefollowingisasampleresponse:{"total_rows":1,"offset":0,"rows":[{"id":"001","key:1,"value":{"rev":"1-4228106699"}},{"id":"126","key":4,"value":{"rev":"3-2206761782","deleted":true}}]}APPENDIXACOUCHDBAPIREFERENCE270ListModifiedDocumentsSpecifyingaKeySetRequestMethod:GETRequestURI:/[db_name]/_all_docs_by_seqRequestHeaders:NoneRequestBody:{"keys":["docid1","docid2",.
.
.
,"docidN"]}RequestParameters:descending(Boolean,reversesorderofresults,defaultfalse)include_docs(Boolean,includefulldocument,defaultfalse)limit(Number,restrictnumberofresults)startkey(String,startkeytoreturndocumentsinarange)endkey(String,endkeytoreturndocumentsinarange)startkey_docid(String,startdocumentIDofrange)endkey_docid(String,enddocumentIDofrange)key(String,onlydisplaydocumentthatmatcheskey)stale(String=ok,don'trefreshviewsforquickerresults)skip(Number,skipthedefinednumberofdocuments)group(Boolean,resultsshouldbegrouped,defaultfalse)group_level(Number,levelatwhichdocumentsshouldbegrouped)reduce(Boolean;ifexists,displayresultofreducefunction;defaulttrue)Description:Returnsdocumentsthathavebeenupdatedordeleted.
SampleRequestURI:http://127.
0.
0.
1:5984/employees/_all_docs_by_seqThefollowingisasampleresponse:{"total_rows":1,"offset":0,"rows":[{"id":"docid1","key:1,"value":{"rev":"1-4228106699"}},{"id":"docid2","key":4,"value":{"rev":"3-2206761782","deleted":true}},…]}APPENDIXACOUCHDBAPIREFERENCE271ViewDocumentRequestMethod:GETRequestURI:/[db_name]/[doc_id]RequestHeaders:NoneRequestBody:EmptyRequestParameters:full(Boolean,returnfulldocumentsincludingmetadata,defaultfalse)revs(Boolean,returnalistofpreviousrevisions,defaultfalse)rev(String,setaspecificrevisionnumber)attachments(Boolean,getattachmentsinBase64,defaultfalse)Description:ReturnsadocumentfromaCouchDBdatabaseSampleRequestURI:http://127.
0.
0.
1:5984/employees/025Thefollowingisasampleresponse:{"_id":"025","_rev":"1-4546452541","name":"JoeLennon","location":"Cork"}APPENDIXACOUCHDBAPIREFERENCE272Create/UpdateAttachmentRequestMethod:PUTRequestURI:/[db_name]/[doc_id]/[attachment_filename]RequestHeaders:Content-Type:[mime_type]Content-Length:[file_size]RequestBody:TheattachmentfiledataitselfRequestParameters:rev(String,revisionnumberofdocument,omittocreatenewdoc)Description:AttachesafiletoadocumentSampleRequestURI:http://127.
0.
0.
1:5984/employees/126/photo.
jpgThefollowingisasampleresponse:{"ok":true,"id":"45fd4543543g43432ab342","rev":"1-2489366227"}APPENDIXACOUCHDBAPIREFERENCE273DeleteAttachmentRequestMethod:DELETERequestURI:/[db_name]/[doc_id]/[attachment_filename]RequestHeaders:NoneRequestBody:EmptyRequestParameters:rev(String,required,revisionnumberofdocument)Description:DeletesanattachmentfromadocumentSampleRequestURI:http://127.
0.
0.
1:5984/employees/126/photo.
jpgrev=1-2489366227Thefollowingisasampleresponse:{"ok":true,"id":"126","rev":"2-130046133"}APPENDIXACOUCHDBAPIREFERENCE274GetAttachmentRequestMethod:GETRequestURI:/[db_name]/[doc_id]/[attachment_filename]RequestHeaders:NoneRequestBody:EmptyRequestParameters:NoneDescription:RetrievesanattachmentfromadocumentSampleRequestURI:http://127.
0.
0.
1:5984/employees/126/photo.
jpgTheresponseistheactualfileattachment(inthisexample,aJPEGphoto).
APPENDIXACOUCHDBAPIREFERENCE275ManagingBulkDocumentsRequestMethod:POSTRequestURI:/[db_name]/_bulk_docsRequestHeaders:X-Couch-Full-Commit:true(optional).
Ensurethatthedocumenthassyncedtodiskbeforereturningsuccess.
RequestBody:JSONobjectwithdocsfieldcontainingarrayofdocumentsRequestParameters:NoneDescription:Creates,updatesanddeletesdocumentsinbulk.
Documentsthataretobeupdatedordeletedmustcontainthe_revfield,specifyingtherevisionnumbertobedeletedasthevalue.
Todeleteadocument,itshouldincludethefield"_deleted":true.
SampleRequestURI:http://127.
0.
0.
1:5984/employees/_bulk_docsThefollowingisasampleresponse:[{"id":"2d32010cc35bdeb92dac487274662809","rev":"1-2530238890"},{"id":"e24d6da28466cf136242b150f38e2dcb","rev":"1-879513885"}]APPENDIXACOUCHDBAPIREFERENCE276ViewAPICreateDesignDocumentRequestMethod:PUTRequestURI:/[db_name]/_design/[design_doc_name]RequestHeaders:NoneRequestBody:JSONdocumentwithviewsfieldforstoringpermanentviews,showsfieldforstoringshowfunctions,andlistsfieldforstoringlistfunctionsRequestParameters:NoneDescription:CreatesadesigndocumenttostorepermanentCouchDBviews,showfunctions,andlistfunctionsSampleRequestURI:http://127.
0.
0.
1:5984/employees/_design/myviewsThefollowingisasampleresponse:{"ok":true,"id":"_design/myviews","rev":"1-1907630304"}APPENDIXACOUCHDBAPIREFERENCE277QueryTemporaryViewRequestMethod:POSTRequestURI:/[db_name]/_temp_viewRequestHeaders:Content-type:application/jsonRequestBody:Mapfunction(required)andReducefunction(optional)ofviewRequestParameters:descending(Boolean,Reversesorderofresults,defaultfalse)include_docs(Boolean,includefulldocument,defaultfalse)limit(Number,restrictnumberofresults)startkey(String,startkeytoreturndocumentsinarange)endkey(String,endkeytoreturndocumentsinarange)startkey_docid(String,startdocumentIDofrange)endkey_docid(String,enddocumentIDofrange)key(String,onlydisplaydocumentthatmatcheskey)stale(String=ok,don'trefreshviewsforquickerresults)skip(Number,skipthedefinednumberofdocuments)group(Boolean,Resultsshouldbegrouped,defaultfalse)group_level(Number,levelatwhichdocumentsshouldbegrouped)reduce(Boolean;ifexists,displayresultofreducefunction;defaulttrue)Description:PerformsaqueryonthedatabaseusingatemporaryviewSampleRequestURI:http://127.
0.
0.
1:5984/employees/_temp_viewThefollowingisasampleresponse:{"total_rows":2,"offset":0,"rows":[{"id":"2d32010cc35bdeb92dac4872746628","key":"2d32010cc35bdeb92dac487274662809","value":null},{"id":"e24d6da28466cf136242b150f8e2dcb","key":"e24d6da28466cf136242b150f8e2dcb","value":null}]}APPENDIXACOUCHDBAPIREFERENCE278QueryPermanentViewRequestMethod:GETRequestURI:/[db_name]/_design/[design_doc_name]/_view/[view_name]RequestHeaders:NoneRequestBody:NoneRequestPParameters:descending(Boolean,reversesorderofresults,defaultfalse)include_docs(Boolean,includefulldocument,defaultfalse)limit(Number,restrictnumberofresults)startkey(String,startkeytoreturndocumentsinarange)endkey(String,endkeytoreturndocumentsinarange)startkey_docid(string,StartdocumentIDofrange)endkey_docid(String,enddocumentIDofrange)key(String,onlydisplaydocumentthatmatcheskey)stale(String=ok,don'trefreshviewsforquickerresults)skip(Number,skipthedefinednumberofdocuments)group(Boolean,resultsshouldbegrouped,defaultfalse)group_level(Number,levelatwhichdocumentsshouldbegrouped)reduce(Boolean;ifexists,displayresultofreducefunction;defaulttrue)Description:ExecutesapermanentviewstoredinaCouchDBdesigndocumentSampleRequestURI:http://127.
0.
0.
1:5984/employees/_design/myviews/_view/getallThefollowingisasampleresponse:{"total_rows":2,"offset":0,"rows":[{"id":"2d32010cc35bdeb92dac4872746628","key":"2d32010cc35bdeb92dac487274662809","value":null},{"id":"e24d6da28466cf136242b150f8e2dcb","key":"e24d6da28466cf136242b150f8e2dcb","value":null}]}APPENDIXACOUCHDBAPIREFERENCE279QueryaPermanentViewSpecifyingAKeySetRequestMethod:GETRequestURI:/[db_name]/_design/[design_doc_name]/_view/[view_name]RequestHeaders:NoneRequestBody:{"keys":["docid1","docid2",.
.
.
,"docidN"]}RequestParameters:descending(Boolean,reversesorderofresults,defaultfalse)include_docs(Boolean,includefulldocument,defaultfalse)limit(Number,restrictnumberofresults)startkey(String,startkeytoreturndocumentsinarange)endkey(String,endkeytoreturndocumentsinarange)startkey_docid(String,startdocumentIDofrange)endkey_docid(String,enddocumentIDofrange)key(String,onlydisplaydocumentthatmatcheskey)stale(String=ok,don'trefreshviewsforquickerresults)skip(Number,skipthedefinednumberofdocuments)group(Boolean,resultsshouldbegrouped,defaultfalse)group_level(Number,levelatwhichdocumentsshouldbegrouped)reduce(Boolean;ifexists,displayresultofreducefunction;defaulttrue)Description:ExecutesapermanentviewstoredinaCouchDBdesigndocumentSampleRequestURI:http://127.
0.
0.
1:5984/employees/_design/myviews/_view/getallThefollowingisasampleresponse:{"total_rows":2,"offset":0,"rows":[{"id":"doc1","key":"2d32010cc35bdeb92dac487274662809","value":null},{"id":"doc2","key":"e24d6da28466cf136242b150f8e2dcb","value":null}…]}APPENDIXACOUCHDBAPIREFERENCE280ExecuteaShowFunctionRequestMethod:GETRequestURI:/[db_name]/_design/[design_doc_name]/_show/[function_name]/[doc_id]RequestHeaders:NoneRequestBody:NoneRequestParameters:format(String,fileformattoshowdocumentin)details(Boolean,showthedocument'sdetails,defaultfalse)Description:PresentsaCouchDBdocumentinadefinedformat,assetoutinashowfunctionSampleRequestURI:http://127.
0.
0.
1:5984/employees/_design/myshows/_show/payslips/200Theresponseisthedocumentrepresentedintheformatsetintheshowfunction.
APPENDIXACOUCHDBAPIREFERENCE281ExecuteaListFunctionRequestMethod:GETRequestURI:/[db_name]/_design/[design_doc_name]/_list/[function_name]/[view_name]RequestHeaders:NoneRequestBody:NoneRequestParameters:descending(Boolean,Reversesorderofresults,defaultfalse)include_docs(Boolean,includefulldocument,defaultfalse)limit(Number,restrictnumberofresults)startkey(String,startkeytoreturndocumentsinarange)endkey(String,endkeytoreturndocumentsinarange)startkey_docid(String,startdocumentIDofrange)endkey_docid(String,enddocumentIDofrange)key(String,onlydisplaydocumentthatmatcheskey)stale(String=ok,don'trefreshviewsforquickerresults)skip(Number,skipthedefinednumberofdocuments)group(Boolean,resultsshouldbegrouped,defaultfalse)group_level(Number,levelatwhichdocumentsshouldbegrouped)reduce(Boolean;ifexists,displayresultofreducefunction;defaulttrue)Description:PresentsalistoftheresultsofaCouchDBview,asdefinedinalistfunctionSampleRequestURI:http://127.
0.
0.
1:5984/employees/_design/myviews/_list/browse/getallTheresponseistheresultsoftheview,inaformatassetoutinthelistfunction.
APPENDIXACOUCHDBAPIREFERENCE282ExecuteaListFunctionSpecifyingaKeySetRequestMethod:GETRequestURI:/[db_name]/_design/[design_doc_name]/_list/[function_name]/[view_name]RequestHeaders:NoneRequestBody:{"keys":["docid1","docid2",.
.
.
,"docidN"]}RequestParameters:descending(Boolean,Reversesorderofresults,defaultfalse)include_docs(Boolean,includefulldocument,defaultfalse)limit(Number,restrictnumberofresults)startkey(String,startkeytoreturndocumentsinarange)endkey(String,endkeytoreturndocumentsinarange)startkey_docid(String,startdocumentIDofrange)endkey_docid(String,enddocumentIDofrange)key(String,onlydisplaydocumentthatmatcheskey)stale(String=ok,don'trefreshviewsforquickerresults)skip(Number,skipthedefinednumberofdocuments)group(Boolean,resultsshouldbegrouped,defaultfalse)group_level(Number,levelatwhichdocumentsshouldbegrouped)reduce(Boolean;ifexists,displayresultofreducefunction;defaulttrue)Description:PresentsalistoftheresultsofaCouchDBview,asdefinedinalistfunctionSampleRequestURI:http://127.
0.
0.
1:5984/employees/_design/myviews/_list/browse/getallTheresponseistheresultsoftheview,inaformatassetoutinthelistfunction.
FurtherInformationTheCouchDBAPIisconstantlyevolving.
Witheachversion,newfeaturesareadded,andolderfeaturesaredeprecated.
YoucanfindoutmoreinformationontheCouchDBAPIinthehandlerssectionofthedefault.
iniconfigurationfileorontheofficialCouchDBwikiathttp://wiki.
apache.
org.
APPENDIXB283HTTPandcurlReferenceCouchDB'sAPIismadeavailableusingaRESTfulHTTPinterface.
ThisappendixoutlineshowanHTTPrequestisprocessed.
HTTPRequestMessageAnHTTPrequestcomprisesthefollowingelements:Therequestline,indicatingthemethod,resource,andHTTPversionoftherequestHeaders,suchasContent-typeandContent-lengthAnemptylineThemessagebodyListingB-1showsanexampleofanHTTPrequestwithallfouroftheseproperties.
ListingB-1.
ASampleHTTPRequestPOST/dbHTTP/1.
1Content-type:application/json{"type":"category","name":"WebTutorials","slug":"web-tutorials"}HTTPRequestMethodsTableB-1describestheHTTPrequestmethodsthatareusedinCouchDB.
PleasenotethattheCOPYmethodisnotpartoftheHTTPstandardbutisratheranextensiontoHTTPusedbyCouchDB.
APPENDIXBHTTPANDCURLREFERENCE284TableB-1.
HTTPRequestMethodsMethodNameDescriptionGETGETrequestsareusuallyusedforside-effect-freetransactions,suchasretrievingdata.
InCouchDB,GETrequestsareusedtorequestdatafromthedatabase.
POSTPOSTrequestsareusedtosubmitdatatoaresource,withthedataincludedinthemessagebody.
InCouchDB,POSTrequestsareusedtocreatenewresources,typicallywheretheURIoftherequestisdifferenttotheresourcethatistobecreated.
PUTPUTrequestsarealsousedtosubmitdatatoaresource,withthedataincludedinthemessagebody.
UnlikePOSTrequests,PUTrequestsaregenerallyusedtoupdateexistingdata,atthesameresourcetheURIisrequestedfrom.
PUTrequestsarealsousedinCouchDBwhereyouwanttospecifytheresourcenamewherethedatawillbeaccessible,thatis,whenyouwanttospecifythedocumentIDwhencreatingadocument,ratherthanhaveoneautomaticallyassignedbytheserver.
DELETEDELETErequestsareusedtodeletethespecifiedresource.
CouchDBusesDELETErequeststodeletedatabasesanddocuments.
COPYThisnonstandardextensiontoHTTPisusedbyCouchDBtocopyoneresourcetoanotherresource.
HTTPResponseAnHTTPresponseconsistsofastatusline,headers,andabody.
Theheadersusuallyprovideinformationsuchasthetimeoftheresponse,informationabouttheserver,thetypeofcontentcontainedintheresponsebody,andmoremeta-information.
Theresponsemessageisreturnedinthebody.
ListingB-2isanexampleofanHTTPresponse.
ListingB-2.
ASampleHTTPResponseHTTP/1.
1200OKServer:CouchDB/0.
9.
0(ErlangOTP/R13B)Date:Sun,04Oct200920:50:00GMTContent-Type:text/plain;charset=utf-8Content-Length:40Cache-Control:must-revalidate{"couchdb":"Welcome","version":"0.
9.
0"}APPENDIXBHTTPANDCURLREFERENCE285HTTPResponseStatusCodesTableB-2describestheHTTPstatuscodesthatCouchDBusestoindicatethesuccessorfailureofadatabasetransaction.
TableB-2.
HTTPResponseStatusCodesStatusCodeDescription200(OK)Therequestwassuccessfullyprocessed.
201(Created)Thedocumentwassuccessfullycreated.
202(Accepted)Thedatabasewassuccessfullycompacted.
304(NotModified)Thedocumenthasnotbeenmodifiedsincethelastupdate.
400(BadRequest)Thesyntaxoftherequestwasinvalidorcouldnotbeprocessed.
404(NotFound)Therequestedresourcewasnotfound.
405(MethodNotAllowed)Therequestwasmadeusinganincorrectrequestmethod;forexample,aGETwasusedwhereaPOSTwasrequired.
409(Conflict)Therequestfailedbecauseofadatabaseconflict.
412(PreconditionFailed)Couldnotcreatedatabase—adatabasewiththatnamealreadyexists.
500(InternalServerError)Therequestwasinvalidandfailed,oranerroroccurredwithintheCouchDBserverthatpreventeditfromprocessingtherequest.
PerformingHTTPRequestswithcurlThecurlcommand-lineutilityprovidesaconvenientwaytomakeHTTPrequests.
ThefollowingisanexampleofthemostbasiccurlHTTPrequesttoCouchDB:curlhttp://127.
0.
0.
1:5984ThiscommandmakesaGETrequesttotheURLhttp://127.
0.
0.
1:5984.
Bydefault,curloutputsthemessagebodyoftheHTTPresponse,asshownhere:{"couchdb":"Welcome","version":"0.
9.
0"}curlhasaseriesofcommand-lineargumentsthatcanbeusedtomodifypartoftheHTTPtransaction.
Forexample,ifyouwanttheresponseheadertobedisplayed,youcanusethe-v(verbose)argument,forexample:curl-vhttp://127.
0.
0.
1:5984Althoughyouarerequestingthesameresourceasbefore,theresponseismuchdifferent:APPENDIXBHTTPANDCURLREFERENCE286*Abouttoconnect()to127.
0.
0.
1port5984(#0)*Trying127.
0.
0.
1.
.
.
connected*Connectedto127.
0.
0.
1(127.
0.
0.
1)port5984(#0)>GET/HTTP/1.
1>User-Agent:curl/7.
16.
3(powerpc-apple-darwin9.
0)libcurl/7.
16.
3OpenSSL/0.
9.
7lzlib/1.
2.
3>Host:127.
0.
0.
1:5984>Accept:*/*>HTTP/1.
1200OKHTTPrequestwithadifferentmethod,suchasPUT,youcanusethe-Xargument.
ThefollowingcommandmakesaPUTrequesttotheURI/mydb,whichwillcreateanewdatabasenamedmydb:curl-XPUThttp://127.
0.
0.
1:5984/mydbIfyouneedtospecifyheadersinyourHTTPrequest,youusethe-Hargument.
ThefollowingexampleusestheDestinationheadertodefinewhereadocumentshouldbecopiedto:curl-XCOPYhttp://127.
0.
0.
1:5984/mydb/doc1-H'Destination:doc2'ManyofCouchDB'sAPImethodsrequireyoutoincludedatainthemessagebody.
Youcansupplythisdatausingthe-dargument,asshowninthefollowingreplicationexample:curl-XPOSThttp://127.
0.
0.
1:5984/_replicate-d'{"source":"db_one","target":"db_two"}'Thepreviousexampleworksquitenicely,becausethedatabeingsuppliedintherequestbodyisshort.
Butwhatifyouneedtosupplyalargesetofdata,suchasanumberofdocumentsbeingaddedusingthebulkdocumentAPIInthiscase,youcansavethedatainafile,forexampledocuments.
json,andthentellcurltoloadthedatafromthisfile.
Thefollowingisanexampleofthistypeofrequest:curl-XPOSThttp://127.
0.
0.
1:5984/mydb/_bulk_docs-d@documents.
jsonAPPENDIXBHTTPANDCURLREFERENCE287curlhasahostofothercommand-linearguments,fartoomanytolisthere.
Afinalargumentthatyoumayfinduseful,however,isthe-oflag.
Youcanusethistooutputtheresponsetoafile,asfollows:curlhttp://127.
0.
0.
1:5984/mydb/mydoc-omydoc.
jsonThiswillstorethedocumentwithdocumentIDmydocinthefilemydoc.
json.
289IndexSymbols+(plus)icon(Futon),63/(slash)asrequestURI,251AACIDproperties,6adhocviews.
SeetemporaryviewsADC(Apple'sDeveloperConnection),32administrationtool.
SeeFutonadministrationtoolaggregatingresultsonviews,143–50_all_dbsresource,104,258_all_docsresource,57,229,267,268_all_docs_by_seqresource,58,269,270all-or-nothingbulkupdates,235Apple'sDeveloperConnection(ADC),32applicationdevelopment,185–209withCouchApp.
SeeCouchAppwithCouchdbkitlibrary(Python),185–91withCouchRestlibrary,191–200withDjangoextensions(Python),200–209apt-getpackagemanager,12arrays,JSON,89,90loopingthrough,96–102atomicity,6attachmentsdeleting,273uploadingwithFuton,76–78,272_attachmentssubdirectory(couchappsdirectory),172Bbackups,248bind_addressoption,81bookmarksapplication(example),200–209booleandatatype(JSON),89buildingCouchDBfromsourcecode,19–28Erlang,23ICU,25Libcurllibrary,24Spidermonkey,25Subversion,26_bulk_docsresource,232,275bulkfetchingofdocuments,229–32,275bulkwritingofdocuments,232–35Cclustering,250CompactDatabaselink(Futon),78–80_compactresource,261compactingdatabases,78–80,224–28,261complexkeys,157_configresource,252configurationinformation,retrieving,252configuringCouchDBinstallation,80,243–46conflictresolution,246–47_conflictsdocument,246consistency,6Content-Typeheader,272,277COPYrequests(HTTP),50,266,284copyingdocuments,266CouchApp,163–84buildingtaskmanager,169–84gettingstarted,165–69installing,163–65couchappsdirectory,creating,165CouchDB,about,3–5CouchDBadministrationtool.
SeeFutonadministrationtoolCouchDBAPI,7triggeringdatabasereplication,223viewsand,119–23map/reducewith,135–36CouchDBapplications,developing,185–209withCouchApp.
SeeCouchAppwithCouchdbkitlibrary(Python),185–91withCouchRestlibrary,191–200withDjangoextensions(Python),200–209CouchDBconfigurationoptions,80CouchDBConfigurationtool(Futon),80CouchDBdependencypackages,12Erlang,23INDEX290ICU,25libcurl,24Spidermoney,25Subversion,26updating(MacOSX),44CouchDBdeployment,241–50backup,248clustering,250configuration,243–46conflictresolution,246–47faulttoleranceandloadbalancing,249measuringperformance,241–43security,247–48CouchDBdocuments,about,6.
Seealsodocumentscouchdbfolder,27CouchDBinstallationonLinux,9–28buildingfromsourcecode,19–28Erlang,23ICU,25Libcurllibrary,24Spidermonkey,25Subversion,26configurationoptions,243–46FedoraLinux,14–19UbuntuLinux8.
10,12–15CouchDBinstallationonMacOSX,29–46configurationoptions,243–46MacPortspackagemanager,34–40usingCouchDBX,45–46Xcodedevelopertools,29–34couchdb-loungeframework,250couchdbservice,configuring,13couchdbuser,creating,13,27CouchDBviews.
SeeviewsCouchdbkitlibrary,185–91Djangoextensions,200–209installing,186CouchDBXpackage,45–46CouchRestlibrary,191–200CouchTasksapplication(example),169–84COUNTfunction(SQL),138countingwordswithmap/reduce(example),139–41CreateDatabaselink(Futon),63,65–70CreateDocumentlink(Futon),70–76curlutility,13,19,50accessingviews,120,135determiningdatabasesize,227enteringJSONdatathrough,56howtouse,51performingHTTPrequests,285–88D-doption,curlutility,51,54datarelationships,viewsand,154–58datatypesJSON,50,89limitingmapfunctionswith,126databasesaddingdocumentsto,54–57,262,263inbulk,232–35usingCouchdbkit(forPython),187usingCouchRest(forRuby),194allowingremoteconnectionsto,81APIsfor(list),256–61backups,248compacting,78–80,224–28,261conflictresolution,246–47creating,49,51–57,256withFuton,65–70inPython,186inRuby,193deleting,53,257deletingdocumentsfrom,55fetchingdocumentsinbulk,229–32,275listing,258replicating,83–85,211–24,260forbackup,248incrementalreplication,215triggeringreplicationfromapplications,223retrievinginformationon,259security,247–48sizeof,determining,227updatingdocumentsin,57,264inbulk,232–35views.
SeeviewsDELETErequests(HTTP),50,265,273,284_deletedmetafield(documents),234deletingattachments,273databases,53,257documents,55,265olddocumentrevisions.
Seecompactiondependencypackages,installing,12Erlang,23ICU,25libcurl,24Spidermonkey,25Subversion,26updating(MacOSX),44deployingCouchDB,241–50backup,248clustering,250configuration,243–46conflictresolution,246–47INDEX291faulttoleranceandloadbalancing,249measuringperformance,241–43security,247–48descendingargument(views),58,152designdocuments,116–18creating,276asJSONobjects,103languageandviewsfields,117permanentviewsin,121showfunctionsin,235–38,280_designresource,276,278,279,280,281,282Destinationheader,266developingCouchDBapplications,185–209withCouchApp.
SeeCouchAppwithCouchdbkitlibrary(Python),185–91withCouchRestlibrary,191–200withDjangoextensions(Python),200–209disk_sizevalue,227Djangoextensions,200–209documentrevisions,6deletingdocumentsand,55purgingold(compaction),224–28_revfield,103document-orienteddatabases,5documentsaddingtodatabases,54–57,262,263inbulk,232–35usingCouchdbkit(forPython),187usingCouchRest(forRuby),194APIsfor,listof,262–75attachingfilesto,76–78,272backupsof,248copying,266creatingwithFuton,70–76deleting,55,265designdocuments.
Seedesigndocumentsfetchinginbulk,229–32,275_idand_revfields,103bulkfetchingand,231bulkwritingand,234JSON,presentinginnon-JSONformats,235–38listing,267,268,269,270querying(returning).
Seeviewsupdating,57,264inbulk,232–35viewing,271.
Seealsoviewsducktyping,112durability,6Eeasy_installutility,165,185emitfunction,126endkeyargument(views),153Erlang,building,23executingviews.
SeeviewsFFabricformulalanguage,4faulttolerance,249FedoraLinux,installingCouchDBon,14–19fetchingdocumentsinbulk,229–32,275file_existserror,52files,attachingtodocuments,76–78,272filteringresults(views),151–54Futonadministrationtool,8,63–86compactingdatabases,78–80,224–28creatingdatabases,65–70creatingdocuments,70–76creatingviews,109–13.
Seealsoviewspermanentviews,113–16map/reducein,127–35replication.
Seereplicatingdatabasesshowfunctions,creating,235TestSuite,running,14,20,29,46databasescreatedby,53toolsof,80–85uploadingattachments,76–78GGETrequests(HTTP),50,284Google'smap/reducefunctionality,125groupingresultsonviews,143–50H-Hoption,curlutility,51historyofCouchDB,4HTTPrequests,283performingwithcurl,285–88HTTPresponses,50,284statuscodesfor,285IICU,building,25_idfield(documents),103fordesigndocuments,103fetchingdocumentsinbulk,231writingdocumentsinbulk,234incrementalreplication,215index.
htmlfile(couchappsdirectory),167installingCouchDBonLinux,9–28buildingfromsourcecode,19–28Erlang,23ICU,25Libcurllibrary,24INDEX292Spidermonkey,25Subversion,26configurationoptions,243–46FedoraLinux,14–19UbuntuLinux8.
10,12–15installingCouchDBonMacOSX,29–46configurationoptions,243–46MacPortspackagemanager,34–40usingCouchDBX,45–46Xcodedevelopertools,29–34isolation,6JJavaScriptObjectNotation.
SeeJSON,SeeJSONJavascriptviewengine,7,57JSON(JavaScriptObjectNotation),7,50,87–105about,87advantages,87CouchDBwith,103–4encapsulatingwithsinglequotes,54enteringdatathroughcurl,56loopingthrougharrays,96–102presentingdocumentsasnon-JSON,235–38roleinasynchronouswebapplications,98structures,defining,91–96syntaxanddatatypes,88–91KKatz,Damien,4keyargument(views),153Llanguagefield(designdocuments),103,117launchingCouchDBserver,13,18,28Libcurllibrary,building,24limitargument(views),154limitqueryparameter,58Linux,installingCouchDBon,9–28buildingfromsourcecode,19–28Erlang,23ICU,25Libcurllibrary,24Spidermonkey,25Subversion,26configurationoptions,243–46FedoraLinux,14–19UbuntuLinux8.
10,12–15listfunctions,238,281,282_listresource,281,282listingdatabases,258listingdocuments,267,268,269,270listskeys,235loadbalancing,249"Localdatabase"option(replication),83,213loopingthroughJSONarrays,96–102MMacOSX,installingCouchDBon,29–46configurationoptions,243–46MacPortspackagemanager,34–40usingCouchDBX,45–46Xcodedevelopertools,29–34MacPortspackagemanager,installing,34–40mainarea,Futon,63main.
cssfile(styledirectory),170,180mapfunction,110,125,Seealsoviews,Seealsomap/reduceconcept;viewsinCouchAppviews,178CouchDBAPIand,135–36creating,126creatinginFuton,127–35SQLqueriesvs.
,136–38wordcountexample,139–41map/reduceconcept.
SeealsomapfunctioninCouchDB,126–27CouchDBAPIand,135–36defined,125inFuton,127–35reduce.
SeereducefunctionSQLqueriesvs.
,136–38wordcountexample,139–41MapFunctionbox(Futon),130map.
jsfile,178Math.
roundfunction(JavaScript),146maxfunction,147measuringCouchDBperformance,241–43minfunction,147Nnavigationbar,Futon,63nonatomicbulkupdates,234nulldatatype(JSON),89nullvalues,108numberdatatype(JSON),89Oobjects,JSON,50,88,89creating(defining),92orderingresults(views),151–54Overviewheading(Futon),63INDEX293Ppaginationbar(Futon),63passwordforuseraccount,13performanceclustering,250loadbalancing,249measurementof,241–43runtimestatistics,retrieving,253permanentviews,109,113–16indesigndocuments,121executingwithCouchDBAPI,120map/reducewith,135–36map/reduce.
Seemap/reduceconceptquerying,278,279pingcommand,217plus(+)icon(Futon),63POSTrequests(HTTP),50,284fetchingdocumentsinbulk,229–32,275writingdocumentsinbulk,232–35purgingolddocumentrevisions.
SeecompactionpushingCouchAppstoCouchDB,165,168PUTrequests(HTTP),50,284pycurlutility,installing,186Pythonexecutingviewsfrom,190installing,163,185PythonapplicationsCouchdbkitlibrarywith(Python),185–91Djangoframework,185–91Qqueryingdatabase.
Seeviewsqueryingrelateddata,155RRails,installing,191RDBMS(relationaldatabasemanagementsystems),107reducefunction,125,SeealsomapfunctioninCouchAppviews,178CouchDBAPIand,135–36creating,126creatinginFuton,127–35SQLqueriesvs.
,136–38wordcountexample,139–41ReduceFunctionbox(Futon),132reduce.
jsfile,178relateddata,viewsand,154–58relationaldatabasemanagementsystems,107remoteconnectionstodatabases,81"Remotedatabase"option(replication),213_replicateresource,260replicatingdatabases,83–85,211–24,260forbackup,248incrementalreplication,215triggeringreplicationfromapplications,223replicationtestfailure,15Replicatortool(Futon),83–85,211–24incrementalreplication,216requests.
SeeHTTPrequestsrereduceargument(reducefunction),127,148responses.
SeeHTTPresponsesRESTful,CouchDBAPIas,7returningdocumentswithqueries.
Seeviews_revmetafield(documents),103fordesigndocuments,103fetchingdocumentsinbulk,231writingdocumentsinbulk,234reversingresultsorderonviews,152revisions,document,6deletingdocumentsand,55purgingold(compaction),224–28_revfield,103roundfunction(JavaScript),146Rubydevelopingapplicationsin,191–200executingviewsfrom,198installingRubyGems,191runtimestatistics,retrieving,253Ssavingviewsaspermanent,113–16schema-freeDBMS,CouchDBas,5,49security,247–48SELECTstatements(SQL)vs.
map/reduce,136–38serverAPIs,listof,251–55serverclustering,250serverinformation,retrieving,251setuptools(Python),164,185showfunctions,235–38,280_showresource,280showskeys,235sizeofdatabase,determining,227/(slash)asrequestURI,251sourcecode,buildingCouchDBfrom,19–28Erlang,23ICU,25Libcurllibrary,24Spidermonkey,25Subversion,26Spidermonkey,building,25Spidermonkey-basedengine.
SeeJavaScriptviewengineINDEX294SQL(StructuredQueryLanguage),107SQLqueriesvs.
map/reduce,136–38stand-aloneapplications,building,185–209withCouchApp.
SeeCouchAppwithCouchdbkitlibrary(Python),185–91withCouchRestlibrary,191–200withDjangoextensions(Python),200–209startingCouchDBserver,13,18,28startkeyargument(views),153_statsresource,253statuscodesforHTTPresponses,285Statuspage(Futon),82storingrelateddata,155stringdatatype(JSON),89StructuredQueryLanguage.
SeeSQLstructures,JSON,91–96stylesubdirectory(couchappsdirectory),167Subversion,building,26sudocommand,MaxOSXLeopardand,43Ttaskmanagerapplication,building,169–84_temp_viewresource,277temporaryviews,109creating,109–13executingwithCouchDBAPI,119makingpermanent,113–16map/reduce.
Seemap/reduceconceptquerying,277Terminalapplication(MacOS),39Terminalwindow,opening,12,16testdatabases,53TestSuite,running,14,20,29,46databasescreatedby,53total_rowsfield,58triggeringdatabasereplication,223types.
SeedatatypesUUbuntuLinux8.
10,installingCouchDBon,12–15update_notificationsection(local.
ini),249updatingdocuments,57,264inbulk,232–35UploadAttachmentlink(Futon),76–78useraccount,creating,13,27UUIDs,retrieving,255_uuidsresource,255Vversioncontrol,compactionand,228viewAPIs,listof,276–82viewengines,108,SeealsoJavaScriptviewenginemap/reduce.
Seemap/reduceconcept_viewresource,278,279viewingdocuments,271views,7,57–59,107–23,143–59,267advancedaggregation,143–50inCouchApps,178CouchDBAPIand,119–23,135–36creating,109–13fromPython(withCouchdbkit),190fromRuby(withCouchRest),198designdocumentswith,116–18map/reduce.
Seemap/reduceconceptorderingandfilteringresults,151–54permanentviews,109,113–16indesigndocuments,121executingwithCouchDBAPI,120querying,277workingwithrelateddata,154–58viewsfield(designdocuments),103,117viewssubdirectory(couchappsdirectory),178Wwgetutility,201wordcountwithmap/reduce(example),139–41writingdocuments.
Seedocuments,addingtodatabasesX-Xoption,curlutility,51Xcodedevelopertools,installing,29–34X-Couch-Full-Commitheader,264,275Yyum,installingCouchDBusing,14–1
DogYun是一家2019年成立的国人主机商,提供VPS和独立服务器租用等,数据中心包括中国香港、美国洛杉矶、日本、韩国、德国、荷兰等,其中VPS包括常规VPS(经典云)和按小时计费VPS(动态云),使用自行开发的面板和管理系统,支持自定义配置,动态云各个硬件独立按小时计费,带宽按照用户使用量计费(不使用不计费)或者购买流量包,线路也可以自行切换。目前商家发布了6.18促销方案,新购动态云7折,经...
搬瓦工最新优惠码优惠码:BWH3HYATVBJW,节约6.58%,全场通用!搬瓦工关闭香港 PCCW 机房通知下面提炼一下邮件的关键信息,原文在最后面。香港 CN2 GIA 机房自从 2020 年上线以来,网络性能大幅提升,所有新订单都默认部署在香港 CN2 GIA 机房;目前可以免费迁移到香港 CN2 GIA 机房,在 KiwiVM 控制面板选择 HKHK_8 机房进行迁移即可,迁移会改变 IP...
弘速云怎么样?弘速云是创建于2021年的品牌,运营该品牌的公司HOSU LIMITED(中文名称弘速科技有限公司)公司成立于2021年国内公司注册于2019年。HOSU LIMITED主要从事出售香港vps、美国VPS、香港独立服务器、香港站群服务器等,目前在售VPS线路有CN2+BGP、CN2 GIA,该公司旗下产品均采用KVM虚拟化架构。可联系商家代安装iso系统,目前推出全场vps新开7折,...
qqhttp代理服务器为你推荐
google地球打不开google地球无法打开怎么办刷网站权重如何提高网站权重和流量如何免费开通黄钻怎么免费开通黄钻湖南商标注册在湖南商标注册到底有什么用,不就是一个图标吗?怎么样免费装扮qq空间如何免费装扮qq空间直播加速有没有软件使已经下载好了的视频播放加速,例如30分钟的视频15分钟或者20分钟播放完安装迅雷看看播放器迅雷看看播放器安装电子商务网站模板电子商务网站策划书小米手柄小米手柄能连几个手机三星s8什么时候上市三星盖乐世S8上市时间公布 三星盖乐世s8多少钱
电信服务器租用 南通服务器租用 域名查询工具 工信部域名备案 新网域名管理 踢楼 virpus 免费主机 59.99美元 cloudstack 免备案空间 evssl 12306抢票助手 骨干网络 腾讯实名认证中心 国外视频网站有哪些 七夕快乐英语 英雄联盟台服官网 后门 windowsserver2008 更多