DocumentRange.sort

Controls the order in which the query returns matching documents.

This method must be called before starting to iterate, or an exeption will be thrown. If multiple calls to sort() are issued, only the last one will have an effect.

struct DocumentRange(Schema)
sort
(
T
)
()

Parameters

order T

A BSON object convertible value that defines the sort order of the result. This BSON object must be structured according to the MongoDB documentation (see below).

Return Value

Type: auto

Reference to the modified original curser instance.

Throws

An exception if there is a query or communication error. Also throws if the method was called after beginning of iteration.

See Also

Meta