couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stock, Ingemar" <Ingemar.St...@Philotech.de>
Subject AW: Struggling with erlang
Date Mon, 07 Jan 2013 13:11:29 GMT
Thanks!

It nearly works as you have written. I only had to add an additional argument in order to
work as filter function:

fun({Props},{Req}) ->
	...



-----Urspr√ľngliche Nachricht-----
Von: Robert Newson [mailto:rnewson@apache.org] 
Gesendet: Montag, 7. Januar 2013 13:36
An: user@couchdb.apache.org
Betreff: Re: Struggling with erlang

Something like;

fun({Props}) ->
  couch_util:get_value(<<"type">>, Props) == <<"tile">> andalso
    couch_util:get_value(<<"key">>, Props) /= undefined andalso
    byte_size(couch_util:get_value(<<"key">>, Props)) =< 8
  end.

On 7 January 2013 12:12, Stock, Ingemar <Ingemar.Stock@philotech.de> wrote:
>   function(doc){
>                 if(doc.type === "tile"){
>                         return doc.key.length <= 8;
>                 }else{
>                         return true;
>                 }
>         }

Mime
View raw message