C100DBA practice question 3 of 25

‘$set' sets the value of

Full set: 130 questions
Answer options
A: Code block
B: Name/value pair
C: Key Correct answer
D: None of the above
Correct 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.

Scroll to Top