Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
besides emit() in map(), can I simply omit this map-reduce cycle?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
λq  
View profile  
 More options Jul 11 2011, 11:57 pm
From: λq <lamb...@gmail.com>
Date: Tue, 12 Jul 2011 11:57:14 +0800
Local: Mon, Jul 11 2011 11:57 pm
Subject: besides emit() in map(), can I simply omit this map-reduce cycle?

Hi guys,

I knew that mapReduce() has a query parameter, but in my case,

{
  'user': user1,
  'top-list': [
    {'score': score1, 'date': date1, 'app': app1},
    {'score': score4, 'date': date4, 'app': app4},
    {'score': score3, 'date': date3, 'app': app3},
  ]

}

I want to use mapReduce() to find the history position change of a
particular my_app

the query parameter can do the job, but IMHO it looks redundant because when
doing the map(), I have to iterate the 'top-list' array again.

Is there something like pass() or omit() besides the standard emit() in map
function? So mongodb could just skip this round of map-reduce and continue
next?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Eliot Horowitz  
View profile  
 More options Jul 12 2011, 12:06 am
From: Eliot Horowitz <eliothorow...@gmail.com>
Date: Tue, 12 Jul 2011 00:06:01 -0400
Local: Tues, Jul 12 2011 12:06 am
Subject: Re: [mongodb-user] besides emit() in map(), can I simply omit this map-reduce cycle?
I'm a bit confused by what you mean.
Is that a sample document that's in the collection?

What would the output look like?

2011/7/11 λq <lamb...@gmail.com>:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
λq  
View profile  
 More options Jul 12 2011, 12:16 am
From: λq <lamb...@gmail.com>
Date: Tue, 12 Jul 2011 12:16:21 +0800
Local: Tues, Jul 12 2011 12:16 am
Subject: Re: [mongodb-user] besides emit() in map(), can I simply omit this map-reduce cycle?

{
  'user': user1,
  'day': '2011-07-09'
  'top-list': [
    {'score': score1, 'date': date1, 'app': app1},
    {'score': score2, 'date': date2, 'app': app2},
    {'score': score3, 'date': date3, 'app': app3},
  ]

},

{
  'user': user1,
  'day': '2011-07-10'
  'top-list': [
    {'score': score1, 'date': date1, 'app': app1},
    {'score': score3, 'date': date3, 'app': app3},
    {'score': score4, 'date': date4, 'app': app4},
  ]
},

{
  'user': user1,
  'day': '2011-07-11'
  'top-list': [
    {'score': score3, 'date': date3, 'app': app3},
    {'score': score4, 'date': date4, 'app': app4},
    {'score': score2, 'date': date2, 'app': app2},
  ]

},

Given app3, return a result like:

{'2011-07-09': 3, '2011-07-10': 2, '2011-07-11': 1}

app3 is at rank #3 place in 2011-07-09, raised to #1 and #1 in the following
days.

But in the collection, app3 is out of the 'top-list'array, so I do not want
the mapReduce() to process this document, yes just a 'query' parameter for
mapReduce() could filter that out, but since I already need to iterate the
whole 'top-list' array in the map() function, I think I don't need 'query'
parameter?

So can I skip a number of documents for a map() ?

2011/7/12 Eliot Horowitz <eliothorow...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Eliot Horowitz  
View profile  
 More options Jul 12 2011, 12:19 am
From: Eliot Horowitz <eliothorow...@gmail.com>
Date: Tue, 12 Jul 2011 00:19:21 -0400
Local: Tues, Jul 12 2011 12:19 am
Subject: Re: [mongodb-user] besides emit() in map(), can I simply omit this map-reduce cycle?
The query would still be helpful if there are documents that don't
have app3 at all.
If all do, then the query isn't needed.

2011/7/12 ëq <lamb...@gmail.com>:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
λq  
View profile  
 More options Jul 12 2011, 12:24 am
From: λq <lamb...@gmail.com>
Date: Tue, 12 Jul 2011 12:24:29 +0800
Local: Tues, Jul 12 2011 12:24 am
Subject: Re: [mongodb-user] besides emit() in map(), can I simply omit this map-reduce cycle?

Yes the 'query' parameter is helpful, but I think 'query' needs to lookup
the whole 'top-list' array or index, then I look them up again because I
need to find its position?

Some performance is wrong here. (I hope mongodb could just get the position
of the element in the array if there is already a 'query' parameter.)

On Tue, Jul 12, 2011 at 12:19 PM, Eliot Horowitz <eliothorow...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Eliot Horowitz  
View profile  
 More options Jul 12 2011, 1:11 am
From: Eliot Horowitz <eliothorow...@gmail.com>
Date: Tue, 12 Jul 2011 01:11:33 -0400
Local: Tues, Jul 12 2011 1:11 am
Subject: Re: [mongodb-user] besides emit() in map(), can I simply omit this map-reduce cycle?
Correct - mongo won't do that for you.
You can open a feature request @ http://jira.mongodb.org

2011/7/12 λq <lamb...@gmail.com>:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »