Table of Contents

Class SelectQuery

Namespace
MongoDB.Driver.Linq
Assembly
MongoDB.Driver.Legacy.dll

Represents a LINQ query that has been translated to an equivalent MongoDB Find query.

public class SelectQuery : TranslatedQuery
Inheritance
SelectQuery
Inherited Members
Extension Methods

Constructors

SelectQuery(MongoCollection, Type)

Initializes a new instance of the MongoLinqFindQuery class.

public SelectQuery(MongoCollection collection, Type documentType)

Parameters

collection MongoCollection

The collection being queried.

documentType Type

The document type.

Properties

IndexHint

Gets the BsonValue (string or document) that defines which index to use (or null if not specified);

public BsonValue IndexHint { get; }

Property Value

BsonValue

OfType

Gets the final result type if an OfType query operator was used (otherwise null).

public Type OfType { get; }

Property Value

Type

OrderBy

Gets a list of Expressions that defines the sort order (or null if not specified).

public ReadOnlyCollection<OrderByClause> OrderBy { get; }

Property Value

ReadOnlyCollection<OrderByClause>

Projection

Gets the Expression that defines the projection (or null if not specified).

public LambdaExpression Projection { get; }

Property Value

LambdaExpression

Skip

Gets the Expression that defines how many documents to skip (or null if not specified).

public int? Skip { get; }

Property Value

int?

Take

Gets the Expression that defines how many documents to take (or null if not specified);

public int? Take { get; }

Property Value

int?

Where

Gets the LambdaExpression that defines the where clause (or null if not specified).

public LambdaExpression Where { get; }

Property Value

LambdaExpression

Methods

BuildQuery()

Creates an IMongoQuery from the where clause (returns null if no where clause was specified).

public IMongoQuery BuildQuery()

Returns

IMongoQuery

An IMongoQuery.

Execute()

Executes the translated Find query.

public override object Execute()

Returns

object

The result of executing the translated Find query.

Translate(Expression)

Translates a LINQ query expression tree.

public void Translate(Expression expression)

Parameters

expression Expression

The LINQ query expression tree.