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

Answer by Kyle H for How to query MongoDB with "like"?

$
0
0

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.


Viewing all articles
Browse latest Browse all 48

Trending Articles