You have a MongoDB collection named employees that contains documents with fields name, department, and salary. You want to update the salary of all employees in the "Marketing" department to $75,000. The original collection looks like this:
What will the collection look like after this update operation?
Answer: C
Question 2
Which of the following statements are true regarding the MongoDB Aggregation Framework and pipelines? (Select two)
Answer: A,E
Question 3
Consider the following scenario: You have a MongoDB collection named users that stores user information. Each document in the collection has the following structure:
{
"_id": ObjectId("609fe4b5728ad805aef1a88d"),
"name": "John Doe",
"age": 30,
"email": "johndoe@example.com",
"address": {
"street": "123 Main St",
"city": "New York",
"state": "NY",
"zipcode": "10001"
}
}
You need to retrieve all the documents from the users collection and convert them to an array format. Which of the following MongoDB queries should you use for this task?
Answer: B
Question 4
Consider a collection named orders with the following documents: