Table of Contents

Class SearchFacetBuilder<TDocument>

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

A builder for a search facet.

public sealed class SearchFacetBuilder<TDocument>

Type Parameters

TDocument

The type of the document.

Inheritance
SearchFacetBuilder<TDocument>
Inherited Members

Methods

Date(string, SearchPathDefinition<TDocument>, IEnumerable<DateTime>, string)

Creates a facet that narrows down search result based on a date.

public SearchFacet<TDocument> Date(string name, SearchPathDefinition<TDocument> path, IEnumerable<DateTime> boundaries, string @default = null)

Parameters

name string

The name of the fact.

path SearchPathDefinition<TDocument>

The field path to facet on.

boundaries IEnumerable<DateTime>

A list of date values that specify the boundaries for each bucket.

default string

The name of an additional bucket that counts documents returned from the operator that do not fall within the specified boundaries.

Returns

SearchFacet<TDocument>

A date search facet.

Date(string, SearchPathDefinition<TDocument>, params DateTime[])

Creates a facet that narrows down search result based on a date.

public SearchFacet<TDocument> Date(string name, SearchPathDefinition<TDocument> path, params DateTime[] boundaries)

Parameters

name string

The name of the fact.

path SearchPathDefinition<TDocument>

The field path to facet on.

boundaries DateTime[]

A list of date values that specify the boundaries for each bucket.

Returns

SearchFacet<TDocument>

A date search facet.

Date<TField>(string, Expression<Func<TDocument, TField>>, IEnumerable<DateTime>, string)

Creates a facet that narrows down search result based on a date.

public SearchFacet<TDocument> Date<TField>(string name, Expression<Func<TDocument, TField>> path, IEnumerable<DateTime> boundaries, string @default = null)

Parameters

name string

The name of the fact.

path Expression<Func<TDocument, TField>>

The field path to facet on.

boundaries IEnumerable<DateTime>

A list of date values that specify the boundaries for each bucket.

default string

The name of an additional bucket that counts documents returned from the operator that do not fall within the specified boundaries.

Returns

SearchFacet<TDocument>

A date search facet.

Type Parameters

TField

The type of the field.

Date<TField>(string, Expression<Func<TDocument, TField>>, params DateTime[])

Creates a facet that narrows down search result based on a date.

public SearchFacet<TDocument> Date<TField>(string name, Expression<Func<TDocument, TField>> path, params DateTime[] boundaries)

Parameters

name string

The name of the fact.

path Expression<Func<TDocument, TField>>

The field path to facet on.

boundaries DateTime[]

A list of date values that specify the boundaries for each bucket.

Returns

SearchFacet<TDocument>

A date search facet.

Type Parameters

TField

The type of the field.

Number(string, SearchPathDefinition<TDocument>, params BsonValue[])

Creates a facet that determines the frequency of numeric values by breaking the search results into separate ranges of numbers.

public SearchFacet<TDocument> Number(string name, SearchPathDefinition<TDocument> path, params BsonValue[] boundaries)

Parameters

name string

The name of the facet.

path SearchPathDefinition<TDocument>

The field path to facet on.

boundaries BsonValue[]

A list of numeric values that specify the boundaries for each bucket.

Returns

SearchFacet<TDocument>

A number search facet.

Number(string, SearchPathDefinition<TDocument>, IEnumerable<BsonValue>, string)

Creates a facet that determines the frequency of numeric values by breaking the search results into separate ranges of numbers.

public SearchFacet<TDocument> Number(string name, SearchPathDefinition<TDocument> path, IEnumerable<BsonValue> boundaries, string @default = null)

Parameters

name string

The name of the facet.

path SearchPathDefinition<TDocument>

The field path to facet on.

boundaries IEnumerable<BsonValue>

A list of numeric values that specify the boundaries for each bucket.

default string

The name of an additional bucket that counts documents returned from the operator that do not fall within the specified boundaries.

Returns

SearchFacet<TDocument>

A number search facet.

Number<TField>(string, Expression<Func<TDocument, TField>>, params BsonValue[])

Creates a facet that determines the frequency of numeric values by breaking the search results into separate ranges of numbers.

public SearchFacet<TDocument> Number<TField>(string name, Expression<Func<TDocument, TField>> path, params BsonValue[] boundaries)

Parameters

name string

The name of the facet.

path Expression<Func<TDocument, TField>>

The field path to facet on.

boundaries BsonValue[]

A list of numeric values that specify the boundaries for each bucket.

Returns

SearchFacet<TDocument>

A number search facet.

Type Parameters

TField

The type of the field.

Number<TField>(string, Expression<Func<TDocument, TField>>, IEnumerable<BsonValue>, string)

Creates a facet that determines the frequency of numeric values by breaking the search results into separate ranges of numbers.

public SearchFacet<TDocument> Number<TField>(string name, Expression<Func<TDocument, TField>> path, IEnumerable<BsonValue> boundaries, string @default = null)

Parameters

name string

The name of the facet.

path Expression<Func<TDocument, TField>>

The field path to facet on.

boundaries IEnumerable<BsonValue>

A list of numeric values that specify the boundaries for each bucket.

default string

The name of an additional bucket that counts documents returned from the operator that do not fall within the specified boundaries.

Returns

SearchFacet<TDocument>

A number search facet.

Type Parameters

TField

The type of the field.

String(string, SearchPathDefinition<TDocument>, int?)

Creates a facet that narrows down Atlas Search results based on the most frequent string values in the specified string field.

public SearchFacet<TDocument> String(string name, SearchPathDefinition<TDocument> path, int? numBuckets = null)

Parameters

name string

The name of the facet.

path SearchPathDefinition<TDocument>

The field path to facet on.

numBuckets int?

The maximum number of facet categories to return in the results.

Returns

SearchFacet<TDocument>

A string search facet.

String<TField>(string, Expression<Func<TDocument, TField>>, int?)

Creates a facet that narrows down Atlas Search result based on the most frequent string values in the specified string field.

public SearchFacet<TDocument> String<TField>(string name, Expression<Func<TDocument, TField>> path, int? numBuckets = null)

Parameters

name string

The name of the facet.

path Expression<Func<TDocument, TField>>

The field path to facet on.

numBuckets int?

The maximum number of facet categories to return in the results.

Returns

SearchFacet<TDocument>

A string search facet.

Type Parameters

TField

The type of the field.