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 constraints might impact your data model for MongoDB? (Select three)
Answer: B,C,E
Question 3
Consider a MongoDB collection named products which has documents in the following format:
{
"_id" : ObjectId("5f5b0d2f3e3dfbcc11c84444"),
"name" : "Smartphone",
"brand" : "Apple",
"category" : "Electronics",
"price" : 1000,
"discount" : 0.1
}
What is the correct syntax to update the "price" field of all documents in the products collection by multiplying it with (1 - discount) using the $set operator and the $multiply operator?
Answer: D
Question 4
Which of the following command skips the first 10 documents in the movies collection and returns all remaining documents?
Answer: D
Question 5
Given a movies collection where each document has the following structure:
{
_id: ObjectId('573a1390f29313caabcd60e4'),
genres: [ 'Short', 'Comedy', 'Drama' ],
title: 'The Immigrant',
year: 1917,
imdb: { rating: 7.8, votes: 4680, id: 8133 },
countries: [ 'USA' ]
}
Which of the following queries will find all the movies that have more votes than the year in which they were released?