Skip to content

Functions: Design documents

Dannes Wessels edited this page Nov 2, 2015 · 10 revisions
couchbase:list-design-documents($clusterId as xs:string, 
  $bucketname as xs:string?) as xs:string*
couchbase:get-design-document($clusterId as xs:string, 
  $bucketname as xs:string?, $design-document-name  as xs:string) as map(*)
couchbase:delete-design-document($clusterId as xs:string, 
  $bucketname as xs:string?, $design-document-name  as xs:string) as xs:boolean
couchbase:upsert-design-document($clusterId as xs:string, 
  $bucketname as xs:string?, $design-document-name  as xs:string, 
  $designdoc as xs:string) as map(*)
couchbase:insert-design-document($clusterId as xs:string, 
  $bucketname as xs:string?, $design-document-name  as xs:string, 
  $designdoc as xs:string) as map(*)

example design document:

{
 "views": {
 "byloc": {
 "map": "function (doc, meta) { if (meta.type == \"json\") { emit(doc.city, doc.sales);  } else { emit([\"blob\"]);  } }"
 } } }

Example

For an example see the unit tests

Clone this wiki locally