Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tradingbills/cb809e92f95d6163058413bef91ac00c to your computer and use it in GitHub Desktop.
Save tradingbills/cb809e92f95d6163058413bef91ac00c to your computer and use it in GitHub Desktop.
ACT,SU
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
var segments = {
"id": "5a709f20e8a46fcd9c0c5d37",
"name": "_HAS ACTIVITY"
}
queryDoc.last_request_at = dateRange
queryDoc["segments.segments.id"] = segments.id
db.getCollection(`${collName}`).aggregate([
{ $match: queryDoc }
,{ "$group": {
_id: null,
// 'Plan Names': { $addToSet: { api_plan_name : "$custom_attributes.api_plan_name"}},
"Total Activity": {
"$sum": 1
}
}
}])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment