mongodb :: MongoMatch :: regex
field
matches pattern
To read more about the available options, see: https://docs.mongodb.com/manual/reference/operator/query/regex/#op._S_regex
{field: {$regex: 'pattern', $options: '<options>'} }
Provides regular expression capabilities for pattern matching strings in queries. MongoDB uses Perl compatible regular expressions (i.e. "PCRE" ).
# Match documents where `field` matches `pattern`
#
# To read more about the available options, see:
# https://docs.mongodb.com/manual/reference/operator/query/regex/#op._S_regex
#
# ~~~json
# {field: {$regex: 'pattern', $options: '<options>'} }
# ~~~
#
# Provides regular expression capabilities for pattern matching strings in queries.
# MongoDB uses Perl compatible regular expressions (i.e. "PCRE" ).
fun regex(field: String, pattern: String, options: nullable String): MongoMatch do
var q = new JsonObject
q["$regex"] = pattern
if options != null then q["$options"] = options
self[field] = q
return self
end
lib/mongodb/queries.nit:184,2--201,4