couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "paul jobs" <webjog...@gmail.com>
Subject Re: what does map do?
Date Sun, 21 Dec 2008 04:36:19 GMT
thanks antony, couchdb is the best thing that happened to our company in the
last one year :)so map is same as emit let me try it, but the map doesnt
work as emit does
emit works to display the documents or rows

*map*
function(doc) { if (doc.appname=="animgifts") emit(doc.name, doc.count); }

*reduce*:
function(keys, values) { return sum(values)}

this outputs properly

but when i try

*map*
function(doc) { if (doc.appname=="animgifts") map(doc.name, doc.count); }

it doesnt output anything with or without reduce function

paul yes i modified the view so it applies to my *doc*
FieldValue*_id*"099ff2a6e345edb5dc36f75ef4109630"*_rev*"3534206171"*appname*
"animgifts"*count*16*created*"2008-12-20T16:16:07Z"*date*"2008-12-20"*
invuids*061545877211050731162279953484035363138484136275459055749842496
127966973277623780418533679440980423221910647883230115733898431257413435313
11891259851459031319915798959811*name*"Animgifts send"*uid*1235401894On Sat,
Dec 20, 2008 at 8:30 PM, Antony Blakey <antony.blakey@gmail.com> wrote:

>
> On 21/12/2008, at 2:52 PM, paul jobs wrote:
>
>   1. function(doc) {
>>  2.   if (doc.doctype == "WikiPage") {
>>  3.     map([doc.title, doc.revision], doc);
>>  4.   }
>>  5. }
>>  *
>>  *
>>  *this doesnt output any rows, is there any purpose as to this view*
>>  *
>>  *
>>  *reference: http://prematureoptimization.org/blog/archives/59*
>>
>
>
>
> map(...) => emit(...)
>
> Antony Blakey
> -------------
> CTO, Linkuistics Pty Ltd
> Ph: 0438 840 787
>
> The difference between ordinary and extraordinary is that little extra.
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message