Created
August 31, 2015 11:49
-
-
Save velikanov/0cb2dfa17a32984e0fed to your computer and use it in GitHub Desktop.
mongo query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.tracker_lead.aggregate([ | |
{ | |
$group: { | |
_id: { | |
year: { | |
$year: "$created_at" | |
}, | |
month: { | |
$month: "$created_at" | |
}, | |
day: { | |
$dayOfMonth: "$created_at" | |
}, | |
flow_id: "$flow.id", | |
site_id: "$flow.site.id", | |
offer_kind_id: "$flow.offer_kind.id", | |
sub1: "$sub1", | |
sub2: "$sub2", | |
advertiser_id: "$advertiser_id" | |
}, | |
click_count: { | |
$sum: 0 | |
}, | |
conversion_count: { | |
$sum: 1 | |
}, | |
approved_conversion_count: { | |
$cond: { | |
if: { | |
$eq: ["$status", "confirm"] | |
}, | |
then: 1, | |
else: 0 | |
} | |
} | |
} | |
}, | |
{ | |
$limit: 100 | |
} | |
]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment