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

Posted by: Pdfprep Category: C100DBA Tags: , ,

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/} } )

Answer: A

Leave a Reply

Your email address will not be published.