Yes, but there's going to be a bunch of fields to aggregate (sub
objects).
If I use $group then do I need to run a new command for each field?
There must be a way to do it all in one shot...??
My documents are more like this:
{
username: 'myname',
email: '
m...@email.com',
location: 'Palo Alto, California',
preferences: {
language: 'en',
timezone: 'PST',
favoriteColor: 'blue'
...
}
}
So say I want to aggregate all users from Palo Alto and get the total
number of english speaking people, favorite colors, etc. All of that.
One call. If possible. I don't know ahead of time (all the time) what
the values for each field may be. When using $addToSet I can get back
all the favorite colors from users that $match the criteria (say
location in this case)...But I can't seem to then get a sum for that.
Thanks for your help Eliot (and anyone else out there).
-Tom
On Jan 28, 8:03 am, Eliot Horowitz <
el...@10gen.com> wrote:
> If I understand, you want to just group by ( language , page ) and
> then do a { $sum : 1 }
>
>
>
>
>
>
>
> On Fri, Jan 27, 2012 at 3:23 PM, Tom M. <
tom.maiar...@gmail.com> wrote:
> > Hi,
>
> > I love the newaggregationframework so far.