I guess I have to wonder ... why? What does spawning buy you here? Anyway, thy syntax would
be
spawn(fun() -> Emit(Login_name, [Password]) end)
Best, Adam
On Nov 19, 2009, at 6:59 PM, Michael McCaffrey wrote:
> Yep, but I've already got the view working and I'm trying to change the
> Emit as follows.
>
> fun({Doc}) ->
> Login_name = proplists:get_value(<<"login_name">>, Doc),
> Password = proplists:get_value(<<"password">>, Doc),
> Emit( Login_name,
> [Password])
> end.
>
> TO
>
> fun({Doc}) ->
> Login_name = proplists:get_value(<<"login_name">>, Doc),
> Password = proplists:get_value(<<"password">>, Doc),
> spawn(Emit( Login_name,
> [Password]))
> end.
>
> Thanks
>
> -----Original Message-----
> From: Michael [mailto:couchdby@autosys.us]
> Sent: Thursday, November 19, 2009 4:23 PM
> To: user@couchdb.apache.org
> Subject: Re: Erlang views
>
> On Thu, Nov 19, 2009 at 04:15:34PM -0700, Michael McCaffrey wrote:
>> Playing around with erlang views and I'm trying to spawn the Emit.
>>
>>
>>
>> I see the Emit is defined in couch_native_process but can't get the
>> spawn to work.
>>
>>
>>
>> Tried spawn(erlang, Emit,["A',"B"]), spawn(couch_native_process,
> Emit,
>> ["A","B"]), etc.
>>
>>
>>
>> Get errors like this.
>>
>> {badarg,
>>
>> [{erlang,spawn,
>>
>> [erlang,
>>
>> #Fun<couch_native_process.5.68659142>,
>>
>> [<<"A">>,<<"B">>]]},
>>
>>
>>
>> Anyone know the proper syntax?
>>
>>
>>
>> Thanks
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>
> Here is an erlang view as loaded into Futon using dropdown
> for Language: erlang, and saved into _design/erlang
>
> fun({Doc}) ->
> Login_name = proplists:get_value(<<"login_name">>, Doc),
> Password = proplists:get_value(<<"password">>, Doc),
> Emit( Login_name,
> [Password])
> end.
>
>
> If I recall, the example in the couch_native_process.erl file
> is not quite right.
>
> Regarding that file, thanks for the tip o' the hat to erlview.
>
> ~Michael
>
> Portland, Oregon, USA
> http://trip.autosys.us
>
|