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 "ApplicationSchema" by AndrewCooper
Date Mon, 04 Oct 2010 03:39:52 GMT
Dear Wiki user,

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

The "ApplicationSchema" page has been changed by AndrewCooper.
The comment on this change is: References to "map" changed to "emit".
http://wiki.apache.org/couchdb/ApplicationSchema?action=diff&rev1=3&rev2=4

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

     "to_docs": "
        function(doc) {
          for( var i=0; i < doc.tags.length; i++) {
-           map(doc.tags[i], null);
+           emit(doc.tags[i], null);
          }
        }"
  }
@@ -105, +105 @@

  Say we're returning a lot of records here and want to reduce them by including the title
(or if no title exists, the name) attribute of the thing that was tagged along with the results.
Change the following line in the ''to_docs'' query above:
  
  {{{
- // map(doc.tags[i], null);
+ // emit(doc.tags[i], null);
  // becomes
- map(doc.tags[i], doc.title || doc.name);
+ emit(doc.tags[i], doc.title || doc.name);
  }}}
  
  Optionally, this view could be named to_docs_with_title so as to be available only if the
extra data is desired.

Mime
View raw message