Search Results for

    Show / Hide Table of Contents

    Class Distinct<T, TProperty>

    Represents a MongoDB Distinct command where you can get back distinct values for a given property of a given Entity.

    Inheritance
    Object
    Distinct<T, TProperty>
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: MongoDB.Entities
    Assembly: MongoDB.Entities.dll
    Syntax
    public class Distinct<T, TProperty>
        where T : IEntity
    Type Parameters
    Name Description
    T

    Any Entity that implements IEntity interface

    TProperty

    The type of the property of the entity you'd like to get unique values for

    Methods

    ExecuteAsync(CancellationToken)

    Run the Distinct command in MongoDB server and get a list of unique property values

    Declaration
    public async Task<List<TProperty>> ExecuteAsync(CancellationToken cancellation = default(CancellationToken))
    Parameters
    Type Name Description
    CancellationToken cancellation

    An optional cancellation token

    Returns
    Type Description
    Task<List<TProperty>>

    ExecuteCursorAsync(CancellationToken)

    Run the Distinct command in MongoDB server and get a cursor instead of materialized results

    Declaration
    public Task<IAsyncCursor<TProperty>> ExecuteCursorAsync(CancellationToken cancellation = default(CancellationToken))
    Parameters
    Type Name Description
    CancellationToken cancellation

    An optional cancellation token

    Returns
    Type Description
    Task<IAsyncCursor<TProperty>>

    IgnoreGlobalFilters()

    Specify that this operation should ignore any global filters

    Declaration
    public Distinct<T, TProperty> IgnoreGlobalFilters()
    Returns
    Type Description
    Distinct<T, TProperty>

    Match(Search, String, Boolean, Boolean, String)

    Specify a search term to find results from the text index of this particular collection.

    TIP: Make sure to define a text index with DB.Index<T>() before searching

    Declaration
    public Distinct<T, TProperty> Match(Search searchType, string searchTerm, bool caseSensitive = false, bool diacriticSensitive = false, string language = null)
    Parameters
    Type Name Description
    Search searchType

    The type of text matching to do

    String searchTerm

    The search term

    Boolean caseSensitive

    Case sensitivity of the search (optional)

    Boolean diacriticSensitive

    Diacritic sensitivity of the search (optional)

    String language

    The language for the search (optional)

    Returns
    Type Description
    Distinct<T, TProperty>

    Match(Template)

    Specify the matching criteria with a template

    Declaration
    public Distinct<T, TProperty> Match(Template template)
    Parameters
    Type Name Description
    Template template

    A Template with a find query

    Returns
    Type Description
    Distinct<T, TProperty>

    Match(Func<FilterDefinitionBuilder<T>, FilterDefinition<T>>)

    Specify the matching criteria with a filter expression

    Declaration
    public Distinct<T, TProperty> Match(Func<FilterDefinitionBuilder<T>, FilterDefinition<T>> filter)
    Parameters
    Type Name Description
    Func<FilterDefinitionBuilder<T>, FilterDefinition<T>> filter

    f => f.Eq(x => x.Prop, Value) & f.Gt(x => x.Prop, Value)

    Returns
    Type Description
    Distinct<T, TProperty>

    Match(Expression<Func<T, Boolean>>)

    Specify the matching criteria with a lambda expression

    Declaration
    public Distinct<T, TProperty> Match(Expression<Func<T, bool>> expression)
    Parameters
    Type Name Description
    Expression<Func<T, Boolean>> expression

    x => x.Property == Value

    Returns
    Type Description
    Distinct<T, TProperty>

    Match(Expression<Func<T, Object>>, Coordinates2D, Nullable<Double>, Nullable<Double>)

    Specify criteria for matching entities based on GeoSpatial data (longitude & latitude)

    TIP: Make sure to define a Geo2DSphere index with DB.Index<T>() before searching

    Note: DB.FluentGeoNear() supports more advanced options

    Declaration
    public Distinct<T, TProperty> Match(Expression<Func<T, object>> coordinatesProperty, Coordinates2D nearCoordinates, double? maxDistance = null, double? minDistance = null)
    Parameters
    Type Name Description
    Expression<Func<T, Object>> coordinatesProperty

    The property where 2DCoordinates are stored

    Coordinates2D nearCoordinates

    The search point

    Nullable<Double> maxDistance

    Maximum distance in meters from the search point

    Nullable<Double> minDistance

    Minimum distance in meters from the search point

    Returns
    Type Description
    Distinct<T, TProperty>

    MatchExpression(Template)

    Specify the matching criteria with a Template

    Declaration
    public Distinct<T, TProperty> MatchExpression(Template template)
    Parameters
    Type Name Description
    Template template

    A Template object

    Returns
    Type Description
    Distinct<T, TProperty>

    MatchExpression(String)

    Specify the matching criteria with an aggregation expression (i.e. $expr)

    Declaration
    public Distinct<T, TProperty> MatchExpression(string expression)
    Parameters
    Type Name Description
    String expression

    { $gt: ['$Property1', '$Property2'] }

    Returns
    Type Description
    Distinct<T, TProperty>

    MatchString(String)

    Specify the matching criteria with a JSON string

    Declaration
    public Distinct<T, TProperty> MatchString(string jsonString)
    Parameters
    Type Name Description
    String jsonString

    { Title : 'The Power Of Now' }

    Returns
    Type Description
    Distinct<T, TProperty>

    Option(Action<DistinctOptions>)

    Specify an option for this find command (use multiple times if needed)

    Declaration
    public Distinct<T, TProperty> Option(Action<DistinctOptions> option)
    Parameters
    Type Name Description
    Action<DistinctOptions> option

    x => x.OptionName = OptionValue

    Returns
    Type Description
    Distinct<T, TProperty>

    Property(Expression<Func<T, Object>>)

    Specify the property you want to get the unique values for (as a member expression)

    Declaration
    public Distinct<T, TProperty> Property(Expression<Func<T, object>> property)
    Parameters
    Type Name Description
    Expression<Func<T, Object>> property

    x => x.Address.Street

    Returns
    Type Description
    Distinct<T, TProperty>

    Property(String)

    Specify the property you want to get the unique values for (as a string path)

    Declaration
    public Distinct<T, TProperty> Property(string property)
    Parameters
    Type Name Description
    String property

    ex: "Address.Street"

    Returns
    Type Description
    Distinct<T, TProperty>
    In this article
    Back to top Developed by Đĵ ΝιΓΞΗΛψΚ and contributors / Licensed under MIT / Website generated by DocFX