Exam C100DEV Topic 1 Question 239 Discussion
Actual exam question for MongoDB's C100DEV exam
Question #: 239
Topic #: 1
Question #: 239
Topic #: 1
There is a gamers collection in your database with the following document structure:
{ _id: 1, level: 15, is_active: true }, { _id: 2, level: 14, is_active: true }, { _id: 3, level: 7, is_active: false }
How do you update the value of the level field to 20 for a player with an id = 2?
Expected result:
{ _id: 1, level: 15, is_active: true }, { _id: 2, level: 20, is_active: true }, { _id: 3, level: 7, is_active: false }
{ _id: 1, level: 15, is_active: true }, { _id: 2, level: 14, is_active: true }, { _id: 3, level: 7, is_active: false }
How do you update the value of the level field to 20 for a player with an id = 2?
Expected result:
{ _id: 1, level: 15, is_active: true }, { _id: 2, level: 20, is_active: true }, { _id: 3, level: 7, is_active: false }
Suggested Answer: C Vote an answer
https://docs.mongodb.com/manual/reference/operator/update/set/
by Odelia at Oct 22, 2024, 01:14 AM
0
0
0
10
Comments
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Report Comment
Commenting
You can sign-up / login (it's free).