querydrill

Learn › Advanced aggregation

Facets, dates and full problems

$facet for dashboards and paging, date grouping, and one end-to-end interview problem.

By the end: Answer several questions in one round trip, and finish a real coding-round task.

Lessons

4
  1. $facet: several pipelines at once

    MongoDB $facet runs several independent pipelines over the same input, returning all their results in one document.

  2. Paging and total count in one query

    Get a page of MongoDB results and the total count in one query, using $facet with $skip/$limit and $count.

  3. Grouping by date

    Group MongoDB documents by date: $year, $month, $dayOfMonth and $dateToString for readable month labels.

  4. A full coding-round problem, worked

    A full MongoDB aggregation interview problem worked end to end: top customers by spend, joined to their user records.

Drills

1 medium · 4 hard
Start reading →Skip to the drills