You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Matthew Sinclair-Day <ms...@gmail.com> on 2010/05/20 03:53:31 UTC

changes filter written in erlang

Hi.

I'm looking for an example of a changes filter written in erlang 
that uses a query argument passed in the request.  I looked on 
the wiki and did not see an example of the erlang function prototype.

Thanks.

Matt


Re: changes filter written in erlang

Posted by Jan Lehnardt <ja...@apache.org>.
Hi Matthew,

On 20 May 2010, at 03:53, Matthew Sinclair-Day wrote:

> I'm looking for an example of a changes filter written in erlang that uses a query argument passed in the request.  I looked on the wiki and did not see an example of the erlang function prototype.

here's one from the CouchDB test suite: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/changes.js?view=markup line 368 (it doesn't exercise the query parameter though).

fun({Doc}, Req) ->
  Value = couch_util:get_value(<<"value">>, Doc),
  (Value rem 2) =:= 0
end.

A good rule of thumb is skimming through the test suite for things that are barely documented. Also, sorry about that :)

Cheers
Jan
--