5 var horizon = new Date(Date.now() - 86400000 * DAYS);
7 function objectIdFromDate(date) {
8 return Math.floor(date.getTime() / 1000).toString(16) + '0000000000000000';
11 var firstId = ObjectId(objectIdFromDate(horizon));
13 var result = db.chatmessages.aggregate([
22 chatUsers: { $addToSet: '$fromUserId' }
40 if: { $eq: ['$troupe.githubType', 'ORG'] },
41 then: '$troupe.lcUri',
42 else: '$troupe.lcOwner'
49 $match: { _id: { $ne: null } }
57 chatUsers: { $addToSet: '$chatUsers' }
63 chatUserCount: { $size: '$chatUsers' }
76 print('Group\tCount');
77 result.forEach(function(x) {
78 print(x._id + '\t' + x.chatUserCount);