Questions tagged [mongodb-aggregation]

Utilizing the MongoDB Aggregation Framework allows users to restructure and consolidate data within MongoDB 2.2 and beyond.

How to tailor the output of $group aggregation in node.js

When using aggregate in node.js, my code looks like this: collection.aggregate( { $group : { _id : "$id_page", "count" : {$sum : 1} } }, {$sort : {"count" : -1}}, {$limit : 1} ).limit(1).toArray(f ...

Incorporate data from two MongoDB collections using aggregation $lookup or populate in a Node.js application

Below are the schemas for two different collections. var activitySchema = new Schema({ activity_id: {type: String, index: {unique: true}, required: true}, begin_date : String, ... }) var registrationSchema = new Schema({ activit ...