d1mitar
d1mitar

Reputation: 226

MongoDB aggregation of large amounts of data

I am doing aggregation on a really large amounts of data and I want to group this data by a date field. So I am doing a projection first so I can add this field:

$project: {
//include other fields
GroupDate: {
   year: { $year: "$Date" },
   month: { $month: "$Date" },
   week: { $week: "$Date" }
} }

and then i group by this "GroupDate".

I was wondering what is the impact of this projection to the execution speed of the aggregation?

Upvotes: 1

Views: 1345

Answers (1)

Artem Mezhenin
Artem Mezhenin

Reputation: 5757

This projection is not a big deal, it has minor impact on whole execution complexity. You can make simple tests with and without this step to find concrete numbers for your case, but, as I said, it just one additional step for Aggregation framework.

If you grouping by date, this post might be helpful

Upvotes: 1

Related Questions