Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save tradingbills/13e97e44bf8ef64819565bb4d7c0d57b to your computer and use it in GitHub Desktop.

Select an option

Save tradingbills/13e97e44bf8ef64819565bb4d7c0d57b to your computer and use it in GitHub Desktop.
Signedup and Paid within dateRange, Itemized who and what
var collName= 20180302
// 2018-03-02 00:00:00 to
// 2018-03-02 23:59:59
var dateRange= {"$gte":1519948800,"$lte":1520035199}
var queryDoc; queryDoc.signed_up_at = dateRange
var paid = "59deb60085a3c22795133b02"
var free = "59dfe40a0a5037ff1c0bd8af"
var segPaidOrFree = paid
queryDoc["segments.segments.id"] = segPaidOrFree;
db.getCollection(`${collName}`).aggregate([{"$match": queryDoc}
,{ $project: { "_id":0,
"Plan Names": "$custom_attributes.api_plan_name",
"User id": "$user_id",
"User email": "$email"
} }
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment