incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aurélien Bénel <aurelien.be...@utt.fr>
Subject Re: Exclude documents from view based on list of regex expressions
Date Tue, 18 Sep 2012 16:10:05 GMT
Hi Carl,

> Whats the best approach for excluding documents from a view based on a list of regex
expressions. For example I want to exclude anything where doc.issue.name contains a value
that matches a list of regex expressions.
> e.g. exclusion list: [/foo/, /bar/]

I am not sure what is the best approach to do that.

For your example, you could have done:

function(o) {
  switch (o.issue.name) {
      case "foo":
      case "bar": break;
      default: emit(o.issue.name, null) 
    }
}

The pros is that you can add other exclude values very easily.  But it only works with strings.
If you need real regexes, I suppose you will need to build one huge regex containing them
all. 


Regards,

Aurélien
Mime
View raw message