Barcelona MongoDB User Group Message Board › Aggregation framework

Aggregation framework

user 8400513
Terrassa, ES
Post #: 3
Hi all!
I'm building an ecommerce dashboard on demand

For that I'm using this aggregate project:

'$match': {
'time': {
'$gte': utilsFecha['esFecha']('%sT00:00:00Z' % path('Yanged/yQueryString/Inicio/0')),
'$lt' : utilsFecha['esFecha']('%sT23:59:59Z' % path('Yanged/yQueryString/Fin/0'))
'content_type': "text/html"
'$project': {
'_id': 0,
'f': {
'a': {'$year': '$time'},
'm': {'$month': '$time'},
'd': {'$dayOfMonth': '$time'}
'user': '$user',
'identificado': {'$cond': [ { '$eq': ['$user', '-'] }, 0, 1 ]}
'$group': {
'_id' : {
'a': '$f.a',
'm': '$f.m',
'd': '$f.d',
'visitas': { '$sum': 1 },
'usuarios': { '$sum': '$identificado' }
'$sort': { '_id': 1 }

Who counts the number of visits and the ones who are made by authenticated users

Now I would like to add another counter to count which one of them are made to a particular uri that ends with a substring (ends with Card or Checkout)

Some people in the irc said that I need to make another aggregation but this sound to me stupid because I need to read the same query to filter it

Can I make it with the project above? (putting another conditional in the project or something like this?)

Powered by mvnForum

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy