Skip to content

Instantly share code, notes, and snippets.

@tradingbills
Last active April 19, 2018 20:35
Show Gist options
  • Save tradingbills/2efb568ee50b6e073ec9ba57242a67aa to your computer and use it in GitHub Desktop.
Save tradingbills/2efb568ee50b6e073ec9ba57242a67aa to your computer and use it in GitHub Desktop.
var collName= 20180419
// 2018-04-18 00:00:00 to
// 2018-04-18 23:59:59
var dateRange= {"$gte":1524009600,"$lte":1524095999}
// -----------------------------------------------------
var queryDoc03={}, segments= { "id": "5a709f20e8a46fcd9c0c5d37","name": "_HAS ACTIVITY"}
queryDoc03.signed_up_at= dateRange
queryDoc03.last_request_at= dateRange
queryDoc03["segments.segments.id"]= {$ne:segments.id}
db.getCollection(`${collName}`).aggregate([ { $match: queryDoc03 }, { "$group": {"_id": null, /* 'Plan Names': { $addToSet: { api_plan_name : "$custom_attributes.api_plan_name"}}, */ "Total Non-Activity": {"$sum": 1} } } ])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment