mongodb like start with code example
Example 1: how to query mongodb with like
db.users.find({"name": /m/})
or
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.
Example 2: like mongodb
db.collection.find( { "url": { "$regex": ".*a.*"} } );
Example 3: like in mongodb
db.users.find({"name": /m/})
Example 4: like in mongodb
db.users.find({"name": /.*m.*/})