5 var horizonTimestamp = Date.now() - 86400000 * 1;
7 var x = db.chatmessages.aggregate({
9 _id: { $gt: createIdForTimestampString(horizonTimestamp) },
10 sent: { $type: 'date' }
15 users: { $addToSet: '$fromUserId' },
16 chats: { $addToSet: '$_id' }
32 // tags: '$troupe.tags'
35 $unwind: '$troupe.tags'
41 // tags: '$troupe.tags'
46 localField: "troupe.tags",
47 foreignField: "synonyms",
51 $unwind: '$tagsynonyms'
54 _id: '$tagsynonyms.name',
55 rooms: { $addToSet: '$_id' },
56 chats: { $push: '$chats' },
57 users: { $push: '$users' }
58 // x: { $first: '$$CURRENT' }
61 printjson(x.toArray());
62 // printCSV(x, ['_id', 'chats', 'rooms', 'users']);