Table of Contents

Method Equals

Namespace
MongoDB.Driver.Search
Assembly
MongoDB.Driver.dll

Equals<TField>(FieldDefinition<TDocument, TField>, TField, SearchScoreDefinition<TDocument>)

Creates a search definition that queries for documents where an indexed field is equal to the specified value. Supported value types are boolean, numeric, ObjectId and date.

public SearchDefinition<TDocument> Equals<TField>(FieldDefinition<TDocument, TField> path, TField value, SearchScoreDefinition<TDocument> score = null) where TField : struct, IComparable<TField>

Parameters

path FieldDefinition<TDocument, TField>

The indexed field to search.

value TField

The value to query for.

score SearchScoreDefinition<TDocument>

The score modifier.

Returns

SearchDefinition<TDocument>

An equality search definition.

Type Parameters

TField

The type of the field.

Equals<TField>(Expression<Func<TDocument, TField>>, TField, SearchScoreDefinition<TDocument>)

Creates a search definition that queries for documents where an indexed field is equal to the specified value. Supported value types are boolean, numeric, ObjectId and date.

public SearchDefinition<TDocument> Equals<TField>(Expression<Func<TDocument, TField>> path, TField value, SearchScoreDefinition<TDocument> score = null) where TField : struct, IComparable<TField>

Parameters

path Expression<Func<TDocument, TField>>

The indexed field to search.

value TField

The value to query for.

score SearchScoreDefinition<TDocument>

The score modifier.

Returns

SearchDefinition<TDocument>

An equality search definition.

Type Parameters

TField

The type of the field.