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 null, boolean, numeric, ObjectId, Guid, date and string.

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

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 null, boolean, numeric, ObjectId, Guid, date and string.

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

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.

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

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

public SearchDefinition<TDocument> Equals<TField>(Expression<Func<TDocument, IEnumerable<TField>>> path, TField value, SearchScoreDefinition<TDocument> score = null)

Parameters

path Expression<Func<TDocument, IEnumerable<TField>>>

The indexed array 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 elements contained in the indexed array field.