Last active
March 2, 2018 15:55
-
-
Save tradingbills/332d9568532c3b2d62f3fcecf4155e0e to your computer and use it in GitHub Desktop.
intercom TFP new signup by dateRange Segmented by Region
This file contains 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
var collName= 20180301 | |
// 2018-03-01 00:00:00 to | |
// 2018-03-01 23:59:59 | |
var dateRange= {"$gte":1519862400,"$lte":1519948799} | |
var queryDoc; queryDoc.signed_up_at = dateRange | |
db.getCollection(`${collName}`) | |
.aggregate([ | |
{ $match: queryDoc } | |
,{ $group: | |
{ _id : "$custom_attributes.site_region", | |
'Plan Names': { $addToSet: { "Plan Name" : "$custom_attributes.api_plan_name"}}, | |
"Total For Region" : {"$sum":1} | |
}} | |
]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment