Home / Companies / MongoDB / Blog / Post Details
Content Deep Dive

Aggregation Framework with Node.js Tutorial

Blog post from MongoDB

Post Details
Company
Date Published
Author
Lauren Schaefer
Word Count
2,399
Language
English
Hacker News Points
-
Summary

The aggregation framework is a powerful tool for analyzing data stored in MongoDB. It allows users to create an aggregation pipeline that consists of one or more stages, each transforming the documents and passing the output to the next stage. The framework has various stages available, including $match, $group, $sort, and $limit. In this tutorial, we used the Aggregation Pipeline Builder in Atlas to create a pipeline for finding the cheapest suburbs in Sydney, Australia. We then executed the pipeline from inside a Node.js script using the aggregate() method of the MongoClient class. The script printed the ten cheapest suburbs with their average prices.