I want to query something with SQL\'s like
query:
SELECT * FROM users WHERE name LIKE \'%m%\'
How to do I achieve the same in
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.