Quantcast
Channel: How to query MongoDB with "like" - Stack Overflow
Viewing all articles
Browse latest Browse all 48

Answer by MADHAIYAN M for How to query MongoDB with "like"?

$
0
0

In SQL, the ‘like’ query is looks like this :

select * from users where name like '%m%'

In MongoDB console, it looks like this :

db.users.find({"name": /m/})     // Not JSON formatted

db.users.find({"name": /m/}).pretty()  // JSON formatted

In addion pretty() method will in all the places where produce formatted JSON structure which is more readable.


Viewing all articles
Browse latest Browse all 48

Trending Articles