Skip to content

Instantly share code, notes, and snippets.

@cjlyth
Created June 12, 2015 13:35
Show Gist options
  • Save cjlyth/2f5b9715bd9b370acef4 to your computer and use it in GitHub Desktop.
Save cjlyth/2f5b9715bd9b370acef4 to your computer and use it in GitHub Desktop.
mongo for work
db.zz_an02_cache.find({an02cacheKey:"8-70273186-1465091679-1434033220871"},{outletId:-1})
db.zz_an02_cache.aggregate( [
{ $match: { an02cacheKey: "1884586746-2-96337202-1434032093666" } }
, { $group: { _id: "$outletId" } }
] );
{ $group: { _id: "$state", totalPop: { $sum: "$pop" } } },
db.zz_an02_cache.aggregate( [
{ $match: { an02cacheKey: "1884586746-2-96337202-1434032093666" } }
, { $group: { _id: "$outletId" } }
, { $group: { _id: 1, count: { $sum: 1 } } }
] );
db.zz_an02_cache.distinct( "outletId",{ an02cacheKey: "1884586746-2-96337202-1434033372067" });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment