You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by Apache Wiki <wi...@apache.org> on 2010/10/14 14:27:13 UTC
[Couchdb Wiki] Update of "View_Snippets" by DougReeder
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);