incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aurélien Bénel <>
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 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 ( {
      case "foo":
      case "bar": break;
      default: emit(, 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


View raw message