-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
Lines 334 to 392 in a14ef61
| const aggregate: Document[] = [ | |
| // Group by siteUrl | |
| { | |
| $group: { | |
| _id: { | |
| siteUrl: '$siteUrl', | |
| userName: '$userName', | |
| featureID: '$featureID', | |
| }, | |
| _total: { $sum: 1 }, | |
| siteUrl: { $first: '$siteUrl' }, | |
| siteName: { $first: '$siteName' }, | |
| }, | |
| }, | |
| // Group users | |
| { | |
| $group: { | |
| _id: { | |
| siteUrl: '$_id.siteUrl', | |
| featureID: '$_id.featureID', | |
| }, | |
| _total: { $sum: '$_total' }, | |
| siteUrl: { $first: '$_id.siteUrl' }, | |
| siteName: { $first: '$siteName' }, | |
| users: { | |
| $push: { | |
| userName: '$_id.userName', | |
| count: '$_total', | |
| }, | |
| }, | |
| }, | |
| }, | |
| // Group features | |
| { | |
| $group: { | |
| _id: { | |
| siteUrl: '$_id.siteUrl', | |
| }, | |
| _total: { $sum: '$_total' }, | |
| siteUrl: { $first: '$_id.siteUrl' }, | |
| siteName: { $first: '$siteName' }, | |
| features: { | |
| $addToSet: { | |
| featureID: '$_id.featureID', | |
| count: '$_total', | |
| }, | |
| }, | |
| users: { $first: '$users' }, | |
| }, | |
| }, | |
| { | |
| $project: { | |
| _id: false, | |
| }, | |
| }, | |
| { $sort: ctx.sort }, | |
| { $limit: ctx.limit + 1 }, | |
| { $skip: ctx.offset }, | |
| ] |
Met OOM problem
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed