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:[email protected]]
Gesendet: Montag, 7. Januar 2013 13:36
An: [email protected]
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 <[email protected]> wrote:
> function(doc){
> if(doc.type === "tile"){
> return doc.key.length <= 8;
> }else{
> return true;
> }
> }