Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
== Outdated egg! This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for [[/eggref/5/couchdb-view-server|the CHICKEN 5 version of this egg]], if it exists. If it does not exist, there may be equivalent functionality provided by another egg; have a look at the [[https://wiki.call-cc.org/chicken-projects/egg-index-5.html|egg index]]. Otherwise, please consider porting this egg to the current version of CHICKEN. [[tags: egg]] == couchdb-view-server [[toc:]] === Description Implements a Scheme [[http://wiki.apache.org/couchdb/View_server|view server]] for [[http://bcouchdb.apache.org/|Apache CouchDB]]. === Deprecation Notice This egg is no longer maintained and is known not to work with recent Chicken versions (at least since 4.8.x). Please get in touch with the author if you want to adopt maintenance. === Author [[/users/moritz-heidkamp|Moritz Heidkamp]] === Requirements Requires the [[environments]] and [[json]] eggs. Also, for it to be somewhat useful, you need a CouchDB server with the following setting in the {{[query_servers]}} config section: <enscript> scheme = /usr/bin/chicken-couchdb </enscript> The path to {{chicken-couchdb}} may be different on your system, of course. You can now use {{"scheme"}} as a view language. === Documentation Within your {{map}} and {{reduce}} definitions, you have access to all R5RS procedures as well as those from SRFI-1. There is a binding for {{null}} which contains the result of {{(void)}} i.e. {{#<unspecified>}} and can be used to generate JSON {{null}}s. The following procedures are also available: ==== emit <procedure>(emit key value)</procedure> Just like in the default JavaScript view server, {{emit}} is implicitly available and is used to emit results from the {{map}} function. ==== ref <procedure>(ref key doc)</procedure> Allows accessing values in avectors by key ([[json]] uses these to represent JSON objects). Example: <enscript highlight=scheme> (ref 'foo '#((foo . bar))) => bar </enscript> ==== log <procedure>(log message)</procedure> Can be used to make the CouchDB server log a message. === Example <enscript highlight=javascript> { "_id": "_design/foo", "_rev": "1-8e9036611c14d4ffe34e9065a3a33683", "language": "scheme", "views": { "by-created-at": { "map": "(lambda (doc) (let ((title (ref 'title doc))) (if title (begin (log (string-append \"mapping \" title)) (emit null (ref 'created-at doc))))))", "reduce": "(lambda (k v r) (fold + 0 v))" } } } </enscript>
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you add 11 to 3?