You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by paul jobs <we...@gmail.com> on 2008/12/21 05:22:26 UTC

what does map do?

   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*

Re: what does map do?

Posted by Paul Davis <pa...@gmail.com>.
Do any of your documents have a doctype attribute?
Do any of your documents that have a doctype attribute have a doctype
attribute value of "WikiPage"?
Do the documents in your db that have a doctype attribute that is
exactly "WikiPage" have both a defined title and revision attribute?

On Sat, Dec 20, 2008 at 11:22 PM, paul jobs <we...@gmail.com> 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*
>

Re: what does map do?

Posted by Paul Davis <pa...@gmail.com>.
On Sat, Dec 20, 2008 at 11:40 PM, Antony Blakey <an...@gmail.com> wrote:
>
> On 21/12/2008, at 3:06 PM, paul jobs wrote:
>
>> 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' was an old function that was replaced with 'emit'. The 'map' function
> shouldn't work at all. What you are seeing is correct.
>

Also, there should be notes in the logs about errors of using an
undefined function.

> Antony Blakey
> --------------------------
> CTO, Linkuistics Pty Ltd
> Ph: 0438 840 787
>
> Lack of will power has caused more failure than lack of intelligence or
> ability.
>  -- Flower A. Newhouse
>
>

Re: what does map do?

Posted by paul jobs <we...@gmail.com>.
http://github.com/jchris/couchdb-example-blog/tree/master
this looks really interesting :)
and yes chris - couchdb has totally changed the way i look at DATA... Data
doesnt hold me hostage anymore!

Data is truly free!

On 12/21/08, Chris Anderson <jc...@gmail.com> wrote:
>
> On Sat, Dec 20, 2008 at 11:45 PM, Paul Jobs <we...@gmail.com> wrote:
> > what are you guys trying to do with couchdb
> > can you show a few examples
>
>
>
> Paul,
>
> I appreciate your questions.
>
> People are using Couch for all kinds of things.
>
> I got into it because I use it to spider the web for a side project of
> Grabb.it's. It made my life hella easier. I'll spare you the details
> of how we used to do it, but with Hadoop / Nutch + CouchDB, my
> cognitive load is greatly reduced. I think making things easier on
> developers is priority #1. CouchDB did that for me, that's why I'm
> here.
>
> This url is full of all kinds of open source software that involves
> Couch somehow: http://github.com/search?q=couchdb
>
> It's worth getting comfortable with git just to have easy access to
> all this software.
>
>
> --
> Chris Anderson
> http://jchris.mfdz.com
>

Re: what does map do?

Posted by Chris Anderson <jc...@gmail.com>.
On Sat, Dec 20, 2008 at 11:45 PM, Paul Jobs <we...@gmail.com> wrote:
> what are you guys trying to do with couchdb
> can you show a few examples


Paul,

I appreciate your questions.

People are using Couch for all kinds of things.

I got into it because I use it to spider the web for a side project of
Grabb.it's. It made my life hella easier. I'll spare you the details
of how we used to do it, but with Hadoop / Nutch + CouchDB, my
cognitive load is greatly reduced. I think making things easier on
developers is priority #1. CouchDB did that for me, that's why I'm
here.

This url is full of all kinds of open source software that involves
Couch somehow: http://github.com/search?q=couchdb

It's worth getting comfortable with git just to have easy access to
all this software.

-- 
Chris Anderson
http://jchris.mfdz.com

Re: what does map do?

Posted by Paul Jobs <we...@gmail.com>.
what are you guys trying to do with couchdb
can you show a few examples
right now i m trying to use it to store data for a game...

I m trying to do a family tree implementation, do you have any pointers 
on how to implement a family tree in couchdb, how to model the data
Parents
children
sibling
cousin
- other relations such as bffs, etc  

Antony Blakey wrote:
>
> On 21/12/2008, at 5:54 PM, paul jobs wrote:
>
>> http://blogs.23.nu/c0re/2008/12/couchdb-broke-my-box/
>> did u see this
>
> No. I suggest you post to couch-users to see if someone else has 
> experienced that issue. It's early days with CouchDB.
>
> Antony Blakey
> -------------
> CTO, Linkuistics Pty Ltd
> Ph: 0438 840 787
>
> Did you hear about the Buddhist who refused Novocain during a root canal?
> His goal: transcend dental medication.
>
>

Re: what does map do?

Posted by Antony Blakey <an...@gmail.com>.
On 21/12/2008, at 3:06 PM, paul jobs wrote:

> 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' was an old function that was replaced with 'emit'. The 'map'  
function shouldn't work at all. What you are seeing is correct.

Antony Blakey
--------------------------
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

Lack of will power has caused more failure than lack of intelligence  
or ability.
  -- Flower A. Newhouse


Re: what does map do?

Posted by paul jobs <we...@gmail.com>.
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 <an...@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.
>
>
>

Re: what does map do?

Posted by Antony Blakey <an...@gmail.com>.
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.