As Jim pointed out below this is basically a _list function. If you're
worried about code duplication I'd suggest factoring out common logic
and using commonjs modules.

On Sun, Jan 29, 2012 at 10:54 AM, Daniel Gonzalez <[email protected]> wrote:
> Hello,
>
> As specified here
> (http://guide.couchdb.org/draft/notifications.html#filters), a filter
> can be used with the _changes feed like this:
>
> curl "$HOST/db/_changes?filter=app/important"
>
> Now I am trying to use this pattern with a standard view access, like this:
>
> curl -X GET 
> $HOST/db/_design/live_data/_view/all-comments&filter=live_data/bytag?tag=testing
>
> I have also tried ? instead of &:
>
> curl -X GET 
> $HOST/db/_design/live_data/_view/all-comments?filter=live_data/bytag?tag=testing
>
> But the filter has no effect: all documents are shown, even those
> which should not be validated by the filter.
>
> The filter that I am using is:
>
> function(doc, req)
> {
>  for( var i in doc.tags ) {
>    if(doc.tags[i] == req.query.tag) {
>      return true;
>    }
>  }
>  return false;
> }
>
> - Am I doing something wrong in the curl calls?
> - Is it at all possible to use views together with filters, or are
> filters limited to the _changes feed? I have seen no examples of
> filters except related to _changes
>
> Thanks,
> Daniel Gonzalez

Reply via email to