couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Couchdb Wiki] Update of "Views_for_Lotus_Geeks" by AlanBell
Date Fri, 01 Jan 2010 11:03:06 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.
http://wiki.apache.org/couchdb/Views_for_Lotus_Geeks?action=diff&rev1=1&rev2=2

--------------------------------------------------

  CouchDB and Lotus Notes are both document databases with many similarities in terms of the
data model and the way views work. Many of the best practices and limitations are the same
for each, but there is new terminology to learn and some pretty powerful extra things you
can do in CouchDB.
  
  == A simple view ==
- For this example lets assume we have a database of task documents
+ For this example lets assume we have a database of really simple task documents, each consisting
of four text fields. Like Notes CouchDB can have fields that contain arrays, in fact they
can contain arbitarily complex data structures, and just like Notes it is schema free so not
all documents have to contain a set collection of fields. For now, lets keep it simple with
these documents:
  
+ {{{
  Form:"Task"
  Priority:"Medium"
  Subject:"Service Car"
  Created:"2009-12-31T19:51:22"
- 
+ }}}
+ {{{
  Form:"Task"
  Priority:"High"
  Subject:"Book restaurant for mum's birthday"
  Created:"2009-12-31T19:51:29"
- 
+ }}}
+ {{{
  Form:"Task"
  Priority:"Medium"
  Subject:"Return library books"
  Created:"2010-01-01T08:31:49"
+ }}}
+ The first thing to notice is that the Created field is in a funny format for Notes, this
is ISO format datetime string, it sorts nicely as text and works well in Python and Javascript
and in fact pretty much every language but Lotusscript. We will come back to times and dates
in views later, but one thing worth mentioning is that you don't use the current time in a
couchdb view formula just like you don't use @now in a view selection or column formula for
exactly the same reason.
  
- so the first thing to notice is that the Created field is in a funny format for Notes, this
is ISO format datetime string, it sorts nicely as text and works well in Python and Javascript
and in fact pretty much every language but Lotusscript. We will come back to times and dates
in views later, but one thing worth mentioning is that you don't use the current time in a
couchdb view formula just like you don't use @now in a view selection or column formula for
exactly the same reason.
+ In Notes we might display the documents in a flat view (categorisation comes later)
  
+ The Selection formula would be:
+ 
+ {{{
+ 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 ||
+ ||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 ||
+ 

Mime
View raw message