couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <>
Subject [Couchdb Wiki] Update of "Views_for_Lotus_Geeks" by AlanBell
Date Fri, 01 Jan 2010 11:39:21 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.

The "Views_for_Lotus_Geeks" page has been changed by AlanBell.


  Select form="Task"
  And view columns would be Priority (sorted), Created (sorted) and Subject
- ||<tablestyle="width: 599px; height: 227px;"style="font-weight: bold;">Priority ||<style="font-weight:
bold;">Created ||<style="font-weight: bold;">Subject ||
+ ||<tablewidth="599px" tableheight="227px"style="font-weight: bold;">Priority ||<style="font-weight:
bold;">Created ||<style="font-weight: bold;">Subject ||
  ||High ||2009-12-31T19:51:29 ||Book restaurant for mum's birthday ||
  ||Medium ||2009-12-31T19:51:22 ||Service Car ||
  ||Medium ||2010-01-01T08:31:49 ||Return library books ||
+ In CouchDB an equivalent view formula would be
+ {{{
+ function(doc) {
+     if(doc.form=="Task"){
+         emit([doc.priority,doc.created],[doc.priority,doc.created,doc.subject])
+     }
+ }
+ }}}
+ The selection formula in notes ends up in the javascript if statement, note the double "=="
which is the operator to test for equality. In javascript a single "=" is the assignment operator
(like := in formula language) if you use a single "=" then it would return all documents,
with their form fields assigned to "Task".
+ The emit function has two parameters, the keys and the values. Keys are kind of like categories
or sorted columns. Values are kind of like column values. If you want you can think of it
like a view with hidden sorted columns as the keys followed by a set of unsorted columns -
the values.

View raw message