mongodb regex code example
Example 1: mongodb regex
{ <field>: { $regex: /pattern/, $options: '<options>' } }
{ <field>: { $regex: 'pattern', $options: '<options>' } }
{ <field>: { $regex: /pattern/<options> } }
Example 2: "compass" mongodb filter or search regex
{
email: RegExp('@gmail.com$', 'i')
}