match string mongodb code example
Example 1: contains mongo-query string
db.users.findOne({"username" : {$regex : ".*son.*"}});
Example 2: mongodb regex
{ <field>: { $regex: /pattern/, $options: '<options>' } }
{ <field>: { $regex: 'pattern', $options: '<options>' } }
{ <field>: { $regex: /pattern/<options> } }