C100DBA practice question 3 of 25
‘$set' sets the value of
Full set: 130 questionsCorrect Answer:
C. Key
Explanation
$set is an update operator that assigns a new value to a specified field (key) in the target document; if the field does not exist it is created.
Why Incorrect
A. $set does not create a code block; it targets document fields.
B. Name/value pair describes the whole assignment, not just the field being set.
D. One option is correct, so “None” is false.
References
1. MongoDB Manual 7.0, “$set”, docs.mongodb.com/manual/reference/operator/update/set/ – first paragraph.
2. MongoDB University M103 Course Notes, “Updating Documents”, Module 2, slide 8.
Keep practicing
Take the free C100DBA practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other C100DBA practice questions
- Question 1If the value of totalKeysExamined is 30000 and the value of totalDocsExamined is 0, which…
- Question 2The oplog (operations log) is a special capped collection that keeps a rolling record of …
- Question 4What does the totalKeysExamined field returned by the explain method indicate?
- Question 5Which mongodb tools allow us to work with our data in a human readable format?
- Question 6Which of the following is incorrect statement about find and findOne operations in MongoD…
- Question 7In a sharded replicas set environment with multiple mongos servers, which of the followin…
