nerdexam
MongoDB

C100DBA · Question #55

'$set' sets the value of

The correct answer is C. Key. In MongoDB, $set is an update operator that sets the value of a specific field, identified by its key (field name) - making C correct. It targets a named key in a document and assigns or updates the value associated with it, e.g., { $set: { "age": 30 } } sets the value of the…

MongoDB Fundamentals

Question

‘$set' sets the value of

Options

  • BName/value pair
  • CKey
  • DNone of the above

How the community answered

(28 responses)
  • B
    4% (1)
  • C
    89% (25)
  • D
    7% (2)

Explanation

In MongoDB, $set is an update operator that sets the value of a specific field, identified by its key (field name) - making C correct. It targets a named key in a document and assigns or updates the value associated with it, e.g., { $set: { "age": 30 } } sets the value of the key "age".

Why B is wrong: A name/value pair refers to the combination of a key and its value together. $set doesn't operate on the pair as a unit - it takes a key as its target and assigns the value, so the distinction matters.

Why D is wrong: "None of the above" is incorrect because C is a valid and accurate description of what $set operates on.

Memory tip: Think of $set like a variable assignment - you provide the key (variable name) and the new value you want it to hold. The key is what you're setting, the value is what you're setting it to.

Topics

#$set#update operator#field value#document update

Community Discussion

No community discussion yet for this question.

Full C100DBA Practice