In a MongoDB database, you have a collection named orders that contains information about various product orders placed by customers. Each document in the collection has the following structure:
{
"customerID": "",
"orderID": "",
"product": "",
"quantity": ,
"price": ,
"date": "",
"status": ""
}
You are required to write an aggregation query that retrieves all orders placed by customers where the quantity of ordered items is greater than 100 and the status of the order is "delivered". Which of the following $match stages would you use to achieve this? Select the best option.
Answer: A
Question 2
In MongoDB, the $out operator is commonly used within an aggregation pipeline. Which of the following statements accurately describes the functionality and usage of the $out operator?
Answer: A
Question 3
In the context of MongoDB development, you are creating a new service that is expected to handle high load. You've decided to leverage the MongoDB drivers' connection pooling capability. What best describes connection pooling and its advantages?
Answer: C
Question 4
In MongoDB, which statement accurately describes a typical task for a MongoDB developer related to schema validation?
Answer: C
Question 5
Consider a MongoDB database containing a collection of documents representing online orders for an e-commerce website. The documents have the following structure:
Select an aggregation pipeline that returns the total sales amount by state and month, for orders placed in the year 2022. The result should have the following format: