Overview
In this unit, you'll learn how to perform basic aggregation with PHP by using MongoDB's aggregation framework. First, you'll learn what aggregation is and explore the components of an aggregation pipeline. Next, you'll learn how to build a pipeline that uses the $match
and $group
stages. Finally, you'll explore the $sort
and $project
stages and build a pipeline that uses them.
Lesson 1 – Building a MongoDB Aggregation Pipeline in PHP Applications
What is the aggregation framework used for? (Select one.)
A. To process documents and return computed results
B. To create database schema
C. To create basic CRUD commands
D. To create serverless functions
Which component(s) of an aggregation pipeline do documents pass through for processing in sequence? (Select one.)
A. Aggregation stages
B. Aggregation operators
C. The MongoDB\Collection::aggregate() method
Lesson 2 – Using MongoDB Aggregation Stages with PHP: Match and Group
Which of the following aggregation pipeline stages separates documents according to a key? (Select one.)
A. $match
B. $group
C. $project
D. $sort
Which of the following aggregation pipeline stages selects documents that meet the specified query condition(s) and passes the documents to the next stage? (Select one.)
A. $match
B. $project
C. $group
D. $sort
Lesson 3 – Using MongoDB Aggregation Stages with PHP: Sort and Project
Which of the following aggregation stages organizes the input documents in ascending or descending order? (Select one.)
A. $orderBy
B. $project
C. $sort
D. $group
Which of the following aggregation stages passes the documents with the requested fields to the next stage in the pipeline? (Select one.)
A. $match
B. $project
C. $group
D. $sort