Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

MongoDB C100DBA Exam - Topic 6 Question 117 Discussion

Posted by Shawna on Nov 24, 2025 at 11:24 AM

What does the following query do when performed on the posts collection? db.posts.update({_id:l},{Title:This is post with ID 1"})

Suggested Answer: B

Get Premium C100DBA Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
30 comments · newest first
GR
Graciela 6 months ago
B is misleading. It doesn't replace the whole document.
NA
Nathalie 6 months ago
A is wrong too. No syntax error here.
BE
Bernadine 6 months ago
Not necessarily. C is valid without $set.
MA
Marci 6 months ago
But what about D? Isn't $set needed?
LA
Laura 6 months ago
I agree, C makes sense. Just the title changes.
LA
Lashawna 7 months ago
I think it's C. It updates the Title of the post.
AL
Alex 7 months ago
I thought you needed $set for updates, this is confusing!
JE
Jeffrey 7 months ago
Wait, can you really update without $set?
SH
Sheridan 8 months ago
Definitely not a full document replacement.
JE
Jettie 8 months ago
I think it just updates the Title, right?
LO
Lourdes 8 months ago
I'd rather update my resume than try to figure out this MongoDB query.
NO
Nobuko 8 months ago
This query is like a surgeon trying to perform heart surgery with a butter knife.
CH
Chery 8 months ago
D) Updating a document is possible only with $set
JO
Josphine 8 months ago
B) Replaces the complete document with _id as 1 with the document specified in second parameter
JA
James 9 months ago
C) Updates the Title of the post
AR
Argelia 9 months ago
I feel like I read that you can only update documents using $set, but I’m not sure if that applies here.
BE
Bette 9 months ago
I practiced a similar question, and I think it’s supposed to update the Title of the post, but I’m not completely confident.
JA
Jamal 9 months ago
I remember something about the update method, but I’m not sure if it replaces the whole document or just updates a field.
LA
Lashawna 9 months ago
I think the key here is that the query is using the update() method without the $set operator. Based on that, my guess is that option B is correct - it replaces the entire document with the _id of 1 with the new document specified in the second parameter.
ID
Idella 9 months ago
I'm a bit confused by this one. The question mentions the posts collection, but the query doesn't have a filter to select a specific document. And the second parameter doesn't look like the normal update syntax. I'm going to have to review my notes on MongoDB update operations before answering this.
ME
Meaghan 10 months ago
I think this query might have a syntax error because of the missing quotation marks around the title.
LO
Lorean 10 months ago
That's a syntax error for sure.
VE
Verlene 10 months ago
Okay, let me see. The query is using the update() method, so it's definitely an update operation. But the second parameter doesn't look like the typical $set format. I'm going to go with option C and say it updates the Title field.
GE
Gerald 11 months ago
Hmm, I'm not sure about this one. The question says it's updating the posts collection, but the query doesn't have the $set operator that I thought was required for updates. I'll have to think this through carefully.
SI
Simona 11 months ago
I think this query is updating the Title field of the document with the _id of 1. The second parameter looks like it's specifying the new Title value.
GI
Gilbert 5 months ago
↳ replying to Simona
Definitely looks like an update to the Title field.
MA
Malcom 5 months ago
↳ replying to Simona
I think it should work if the syntax was correct.
TW
Twanna 6 months ago
↳ replying to Simona
But what about the syntax? It looks off to me.
VE
Veronika 10 months ago
↳ replying to Simona
Yeah, the second parameter is clearly a new Title.
CL
Clorinda 10 months ago
↳ replying to Simona
I agree, it seems like it's just updating the Title.
0/2000 characters

Save Cancel