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 - 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
-
-
-
(Locked)
Find: Using aggregation pipeline to process documents1m 57s
-
(Locked)
Find: Aggregation with $group and $sort2m 5s
-
(Locked)
Find: Use $project to shape your output2m 4s
-
(Locked)
Find: Create calculated fields2m 40s
-
(Locked)
Aggregate: Custom logic with an accumulator5m 2s
-
(Locked)
Aggregate: Custom logic with a function2m 22s
-
(Locked)
-
-