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 "View_Snippets" by DougReeder
Date Thu, 14 Oct 2010 12:27:13 GMT
Dear Wiki user,

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

The "View_Snippets" page has been changed by DougReeder.
The comment on this change is: improved JavaScript.
http://wiki.apache.org/couchdb/View_Snippets?action=diff&rev1=38&rev2=39

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

  }
  }}}
  
- However, if you have more than just a few fields that need to be tested for abcense you
can use another approach instead of creating a view for each negation:
+ However, if you have more than just a few fields that need to be tested for absense you
can use another approach instead of creating a view for each negation:
  
  {{{#!highlight javascript
  function (doc) {
@@ -694, +694 @@

    for (idx in fields)
    {
      // Does the current field exists?
-     if (typeof eval("doc." + fields[idx]) === void 0)
+     if (!doc.hasOwnProperty(fields[idx]))
      {
        // It doesn't, emit the field name as key
        emit(fields[idx], null);

Mime
View raw message