From the course: Coding Exercises: Advanced MongoDB

Unlock the full course today

Join today to access over 24,300 courses taught by industry experts.

Find: Using aggregation pipeline to process documents

Find: Using aggregation pipeline to process documents - MongoDB Tutorial

From the course: Coding Exercises: Advanced MongoDB

Find: Using aggregation pipeline to process documents

(upbeat 8-bit music) - [Instructor] Straight or standard queries that simply find and sort data will cover most of your use cases. But as your reporting needs get more complicated and your queries go from simply finding records into more of a find and process methodology, we'll need a means to do that processing and produce more useful output. In Mongo, we can run what's done as an aggregation pipeline which processes our document collection through a number of stages. Similar to chaining methods, as we might have done with a find, sort, limit chain, aggregate treats a document collection or the result of a search as the input to the next stage in the process, allowing us to have more tight control over the data and the output. For this challenge, your task is to use an aggregation pipeline with the aggregate method to return a count of all active customers in the database. Once you've completed the base task,…

Contents