Table of Contents

Method SetSortOrder

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

SetSortOrder(IMongoSortBy)

Sets the sort order for the server to sort the documents by before returning them.

public virtual MongoCursor<TDocument> SetSortOrder(IMongoSortBy sortBy)

Parameters

sortBy IMongoSortBy

The sort order.

Returns

MongoCursor<TDocument>

The cursor (so you can chain method calls to it).

SetSortOrder(params string[])

Sets the sort order for the server to sort the documents by before returning them.

public virtual MongoCursor<TDocument> SetSortOrder(params string[] keys)

Parameters

keys string[]

The names of the fields to sort by.

Returns

MongoCursor<TDocument>

The cursor (so you can chain method calls to it).