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

Answer by ajay_fuel_stock_lamp_stack for How to query MongoDB with "like"?

$
0
0

There are various ways to accomplish this.

simplest-one

db.users.find({"name": /m/}){ <field>: { $regex: /pattern/, $options: '<options>' } }{ <field>: { $regex: 'pattern', $options: '<options>' } }{ <field>: { $regex: /pattern/<options> } }db.users.find({ "name": { $regex: "m"} })

More details can be found herehttps://docs.mongodb.com/manual/reference/operator/query/regex/


Viewing all articles
Browse latest Browse all 48

Trending Articles