Class SortByBuilder<TDocument>
A builder for specifying a sort order.
[Serializable]
[BsonSerializer(typeof(SortByBuilder<>.Serializer))]
public class SortByBuilder<TDocument> : BuilderBase, IConvertibleToBsonDocument, IMongoSortBy
Type Parameters
TDocument
The type of the document.
- Inheritance
-
SortByBuilder<TDocument>
- Implements
- Inherited Members
- Extension Methods
Constructors
SortByBuilder()
Initializes a new instance of the SortByBuilder<TDocument> class.
public SortByBuilder()
Methods
Ascending(params Expression<Func<TDocument, object>>[])
Adds keys to be sorted by in ascending order.
public SortByBuilder<TDocument> Ascending(params Expression<Func<TDocument, object>>[] memberExpressions)
Parameters
memberExpressions
Expression<Func<TDocument, object>>[]The member expressions indicating which elements to sort by.
Returns
- SortByBuilder<TDocument>
The builder (so method calls can be chained).
Descending(params Expression<Func<TDocument, object>>[])
Adds keys to be sorted by in descending order.
public SortByBuilder<TDocument> Descending(params Expression<Func<TDocument, object>>[] memberExpressions)
Parameters
memberExpressions
Expression<Func<TDocument, object>>[]The member expressions indicating which elements to sort by.
Returns
- SortByBuilder<TDocument>
The builder (so method calls can be chained).
MetaTextScore(Expression<Func<TDocument, object>>)
Adds a key to sort by the computed relevance score when using text search. The name of the key should be the name of the projected relevance score field.
public SortByBuilder<TDocument> MetaTextScore(Expression<Func<TDocument, object>> memberExpression)
Parameters
memberExpression
Expression<Func<TDocument, object>>The member expression specifying the projected field.
Returns
- SortByBuilder<TDocument>
The builder (so method calls can be chained).
ToBsonDocument()
Converts this object to a BsonDocument.
public override BsonDocument ToBsonDocument()
Returns
- BsonDocument
A BsonDocument.