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 5 Question 106 Discussion

Posted by Karrie on Jan 27, 2025 at 08:51 AM

Which of the following commands will return all the posts with number of likes greater than 100 and less than 200, both inclusive?

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
29 comments · newest first
TY
Ty 10 months ago
I thought all of them were valid options at first!
AR
Artie 11 months ago
Wait, D has a syntax error, right?
LU
Lura 11 months ago
C looks good, but it misses 200.
KR
Krystal 11 months ago
I think B is incorrect because it excludes 100.
JU
Julene 11 months ago
A is definitely the right choice!
JE
Jesusa 12 months ago
I’m confused about D; it looks like a typo with that extra ">" at the end. I hope that’s not an option!
LE
Leota 12 months ago
I practiced a similar question, and I feel like A is definitely the safest choice since it covers both ends.
KA
Katina 12 months ago
I'm not entirely sure, but I remember something about $gt and $lt not including the boundary values. So maybe C is correct?
EM
Emerson 1 year ago
I think option A is the right one because it uses both $gte and $lte, which means it includes 100 and 200.
MA
Margo 1 year ago
I'm leaning towards C. The $gte and $lt operators will give me the same result as A, but it might be a bit clearer to read.
JO
Johana 1 year ago
Option A looks good to me. The $gte and $lte operators will return the posts with likes between 100 and 200, including the endpoints. Can't go wrong with that.
CE
Celestina 1 year ago
Hmm, I'm a bit confused. I'm not sure if I should use $gte and $lte or $gt and $lt. I'll have to double-check the documentation to make sure I get this right.
SA
Salina 1 year ago
I think the answer is A. The query looks straightforward, using $gte and $lte to get the posts with likes between 100 and 200 inclusive.
GA
Garry 1 year ago
If I was a post with 100 likes, I'd be offended to be excluded from this query. Gotta love those inclusive ranges!
GE
Geoffrey 1 year ago
Option B seems to be the most straightforward approach. Why complicate it with inclusive ranges?
LI
Linn 1 year ago
↳ replying to Geoffrey
User 3: Agreed, no need to complicate things with inclusive ranges.
JA
Janet 1 year ago
↳ replying to Geoffrey
User 2: Yeah, it's simpler that way.
MI
Mike 1 year ago
↳ replying to Geoffrey
User 1: I think option B is the correct one.
TR
Trevor 1 year ago
Ha! Option D is a classic trick question. The greater than and less than symbols should be outside the curly braces.
WE
Wei 1 year ago
I think Option C is the way to go. It's more explicit about the inclusive range with $gte and $lt.
MA
Marvel 1 year ago
↳ replying to Wei
User3: Yeah, Option C is the best choice for that query.
MA
Mammie 1 year ago
↳ replying to Wei
User2: I agree, $gte and $lt make it clear.
MA
Marshall 1 year ago
↳ replying to Wei
User1: I think Option C is the correct one.
IL
Ilene 2 years ago
Option A looks like the correct one to me. It uses the $gte and $lte operators to get posts with likes between 100 and 200, inclusive.
FR
Freida 1 year ago
↳ replying to Ilene
Yes, option A is the right choice. It specifies the range correctly with $gte and $lte operators.
MA
Marylin 1 year ago
↳ replying to Ilene
I think option A is correct too. It covers the range of likes we are looking for.
EV
Evangelina 2 years ago
I'm not sure, but I think option C might also work because it uses $lt for less than 200.
KA
Kayleigh 2 years ago
I agree with Christene, option A makes sense because it includes both 100 and 200 in the range.
CH
Christene 2 years ago
I think the correct command is A) db.posts.find({ likes : { $gte : 100 , $lte : 200 } } );
0/2000 characters

Save Cancel