Table of Contents

Method Regex

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

Regex(FieldDefinition<TDocument>, BsonRegularExpression)

Creates a regular expression filter.

public FilterDefinition<TDocument> Regex(FieldDefinition<TDocument> field, BsonRegularExpression regex)

Parameters

field FieldDefinition<TDocument>

The field.

regex BsonRegularExpression

The regex.

Returns

FilterDefinition<TDocument>

A regular expression filter.

Regex(Expression<Func<TDocument, object>>, BsonRegularExpression)

Creates a regular expression filter.

public FilterDefinition<TDocument> Regex(Expression<Func<TDocument, object>> field, BsonRegularExpression regex)

Parameters

field Expression<Func<TDocument, object>>

The field.

regex BsonRegularExpression

The regex.

Returns

FilterDefinition<TDocument>

A regular expression filter.