New Year Sale ! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

MongoDB Exam C100DBA Topic 1 Question 103 Discussion

Actual exam question for MongoDB's C100DBA exam
Question #: 103
Topic #: 1
[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:

Barrie
18 days ago
Option A is the way to go, no doubt about it. Though I do wish MongoDB had a $like operator, just to make things a bit more SQL-ish, you know?
upvoted 0 times
Margot
5 days ago
Option A is the way to go, no doubt about it.
upvoted 0 times
...
...
Micaela
23 days ago
Wait, does MongoDB even have a $like operator? That sounds more like something from SQL. A is the correct answer, no question.
upvoted 0 times
Ethan
11 days ago
I think you're right, MongoDB doesn't have a $like operator.
upvoted 0 times
...
Emmett
11 days ago
A) db.posts.find( { author: /John/ } )
upvoted 0 times
...
...
Verda
29 days ago
Option C looks like it's trying to be clever, but the $like operator is SQL, not MongoDB. A is the way to go, no doubt about it.
upvoted 0 times
...
Shawana
1 months ago
Hmm, I wonder if the exam writers are just trying to trick us with these other options. A is the only one that makes sense to me.
upvoted 0 times
...
Eric
1 months ago
I was going to say option B, but then I remembered that /AjohnA/ is not a valid regular expression. A is the clear winner here.
upvoted 0 times
Francoise
4 days ago
I agree, A is the correct choice
upvoted 0 times
...
Brandon
23 days ago
I think the answer is A
upvoted 0 times
...
...
Marsha
1 months ago
I'm not sure, but I think it's either A) or D). Let me check the MongoDB documentation to confirm.
upvoted 0 times
...
Rebbecca
1 months ago
Option D seems like it should work, but the $like operator doesn't exist in MongoDB. A is the way to go for sure.
upvoted 0 times
Mozell
21 days ago
Option D seems like it should work, but the $like operator doesn't exist in MongoDB. A is the way to go for sure.
upvoted 0 times
...
Mari
23 days ago
A) db.posts.find( { author: /John/ } )
upvoted 0 times
...
...
Alfred
1 months ago
I agree with Grover, because using /John/ in MongoDB is equivalent to LIKE '%john%' in SQL.
upvoted 0 times
...
Ilona
1 months ago
I agree, option A is the way to go. MongoDB's query language is much more concise and powerful than SQL.
upvoted 0 times
...
Arminda
2 months ago
Option A looks correct, it uses the regex search operator to find posts where the author field contains 'John'.
upvoted 0 times
Maurine
6 days ago
Exactly, the correct option is using the regex search for 'John'.
upvoted 0 times
...
Cory
7 days ago
A) db.posts.find( { author: /John/ } )
upvoted 0 times
...
Sue
12 days ago
No, that option doesn't look right. It has a syntax error.
upvoted 0 times
...
Blondell
23 days ago
B) db.posts.find( { author: /AjohnA/ > )
upvoted 0 times
...
Maira
1 months ago
That makes sense, it's using the regex operator to search for 'John' in the author field.
upvoted 0 times
...
Hoa
1 months ago
A) db.posts.find( { author: /John/ } )
upvoted 0 times
...
...
Grover
2 months ago
I think the answer is A) db.posts.find( { author: /John/ } )
upvoted 0 times
...

Save Cancel