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 8 Question 130 Discussion

What is the equivalent command in MongoDB for the following SQL query?SELECT * FROM posts WHERE author like "%john%"
A) db.posts.find( { author: /John/ } )
B) db.posts.find( { author: /AjohnA/ > )
C) db.posts.find( { $like: {author: /John/} } )
D) db.posts.find( { author: {$like: /John/} } )

MongoDB C100DBA Exam - Topic 8 Question 130 Discussion

Actual exam question for MongoDB's C100DBA exam
Question #: 130
Topic #: 8
[All C100DBA Questions]

What is the equivalent command in MongoDB for the following SQL query?

SELECT * FROM posts WHERE author like "%john%"

Show Suggested Answer Hide Answer
Suggested Answer: A

Contribute your Thoughts:

0/2000 characters
Edelmira
7 hours ago
I’m leaning towards A too, but I’m confused about whether the case sensitivity of the regex matters in this case.
upvoted 0 times
...
Gabriele
5 days ago
I feel like options C and D are definitely wrong because MongoDB doesn't use a $like operator.
upvoted 0 times
...
Lonny
11 days ago
I remember practicing a similar question, and I think the correct syntax for regex in MongoDB is important here.
upvoted 0 times
...
Van
16 days ago
I think the answer might be A, but I'm not entirely sure about the regex part.
upvoted 0 times
...

Save Cancel