That would have to be:
db.users.find({"name": /.*m.*/})
or, similar:
db.users.find({"name": /m/})
You're looking for something that contains "m" somewhere (SQL's '%
' operator is equivalent to Regexp's '.*
'), not something that has "m" anchored to the beginning of the string.
manpreet
Best Answer
2 years ago
I want to query something as SQL's
like
query:How to do the same in MongoDB?
I can't find a operator for
like
in the Documentations.