Created
June 2, 2012 08:51
-
-
Save baio/2857390 to your computer and use it in GitHub Desktop.
min, max date in group
This file contains hidden or 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
#mongo dev/node/tourism/Parsers/_intel/group.js | |
print "go..." | |
grps = db.tour.group | |
key: | |
dom : true | |
country : true | |
initial: | |
cnt: 0 | |
min : '' | |
max : '' | |
reduce: (doc, out) -> | |
if !out.min or out.min > doc.checkin then out.min = doc.checkin | |
if !out.max or out.max < doc.checkin then out.max = doc.checkin | |
out.cnt++ | |
printjson g for g in grps |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment