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?
> 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 received this message because you are subscribed to the Google Groups > "mongodb-user" group. > To post to this group, send email to mongodb-user@googlegroups.com. > To unsubscribe from this group, send email to > mongodb-user+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/mongodb-user?hl=en.
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?
> 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>: > > 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 received this message because you are subscribed to the Google Groups > > "mongodb-user" group. > > To post to this group, send email to mongodb-user@googlegroups.com. > > To unsubscribe from this group, send email to > > mongodb-user+unsubscribe@googlegroups.com. > > For more options, visit this group at > > http://groups.google.com/group/mongodb-user?hl=en.
> -- > You received this message because you are subscribed to the Google Groups > "mongodb-user" group. > To post to this group, send email to mongodb-user@googlegroups.com. > To unsubscribe from this group, send email to > mongodb-user+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/mongodb-user?hl=en.
> 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() ?
>> 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>: >> > 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 received this message because you are subscribed to the Google >> > Groups >> > "mongodb-user" group. >> > To post to this group, send email to mongodb-user@googlegroups.com. >> > To unsubscribe from this group, send email to >> > mongodb-user+unsubscribe@googlegroups.com. >> > For more options, visit this group at >> > http://groups.google.com/group/mongodb-user?hl=en.
>> -- >> You received this message because you are subscribed to the Google Groups >> "mongodb-user" group. >> To post to this group, send email to mongodb-user@googlegroups.com. >> To unsubscribe from this group, send email to >> mongodb-user+unsubscribe@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/mongodb-user?hl=en.
> -- > You received this message because you are subscribed to the Google Groups > "mongodb-user" group. > To post to this group, send email to mongodb-user@googlegroups.com. > To unsubscribe from this group, send email to > mongodb-user+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/mongodb-user?hl=en.
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:
> > 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() ?
> >> 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>: > >> > 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 received this message because you are subscribed to the Google > >> > Groups > >> > "mongodb-user" group. > >> > To post to this group, send email to mongodb-user@googlegroups.com. > >> > To unsubscribe from this group, send email to > >> > mongodb-user+unsubscribe@googlegroups.com. > >> > For more options, visit this group at > >> > http://groups.google.com/group/mongodb-user?hl=en.
> >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "mongodb-user" group. > >> To post to this group, send email to mongodb-user@googlegroups.com. > >> To unsubscribe from this group, send email to > >> mongodb-user+unsubscribe@googlegroups.com. > >> For more options, visit this group at > >> http://groups.google.com/group/mongodb-user?hl=en.
> > -- > > You received this message because you are subscribed to the Google Groups > > "mongodb-user" group. > > To post to this group, send email to mongodb-user@googlegroups.com. > > To unsubscribe from this group, send email to > > mongodb-user+unsubscribe@googlegroups.com. > > For more options, visit this group at > > http://groups.google.com/group/mongodb-user?hl=en.
> -- > You received this message because you are subscribed to the Google Groups > "mongodb-user" group. > To post to this group, send email to mongodb-user@googlegroups.com. > To unsubscribe from this group, send email to > mongodb-user+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/mongodb-user?hl=en.
> 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:
>> 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.
>> > 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() ?
>> >> 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>: >> >> > 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 received this message because you are subscribed to the Google >> >> > Groups >> >> > "mongodb-user" group. >> >> > To post to this group, send email to mongodb-user@googlegroups.com. >> >> > To unsubscribe from this group, send email to >> >> > mongodb-user+unsubscribe@googlegroups.com. >> >> > For more options, visit this group at >> >> > http://groups.google.com/group/mongodb-user?hl=en.
>> >> -- >> >> You received this message because you are subscribed to the Google >> >> Groups >> >> "mongodb-user" group. >> >> To post to this group, send email to mongodb-user@googlegroups.com. >> >> To unsubscribe from this group, send email to >> >> mongodb-user+unsubscribe@googlegroups.com. >> >> For more options, visit this group at >> >> http://groups.google.com/group/mongodb-user?hl=en.
>> > -- >> > You received this message because you are subscribed to the Google >> > Groups >> > "mongodb-user" group. >> > To post to this group, send email to mongodb-user@googlegroups.com. >> > To unsubscribe from this group, send email to >> > mongodb-user+unsubscribe@googlegroups.com. >> > For more options, visit this group at >> > http://groups.google.com/group/mongodb-user?hl=en.
>> -- >> You received this message because you are subscribed to the Google Groups >> "mongodb-user" group. >> To post to this group, send email to mongodb-user@googlegroups.com. >> To unsubscribe from this group, send email to >> mongodb-user+unsubscribe@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/mongodb-user?hl=en.
> -- > You received this message because you are subscribed to the Google Groups > "mongodb-user" group. > To post to this group, send email to mongodb-user@googlegroups.com. > To unsubscribe from this group, send email to > mongodb-user+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/mongodb-user?hl=en.