Method MongoCursor.sort
Controls the order
that the query returns matching documents.
This method must be called before beginning iteration, otherwise exeption will be thrown.
Only the last sort
() applied to cursor has any effect.
Prototype
MongoCursor sort(T)( T order );
Parameters
Name | Description |
---|---|
order | a document that defines the sort order of the result set |
Returns
the same cursor
Throws
An exception if there is a query or communication error. Also throws if the method was called after beginning of iteration.
See Also
Authors
Sönke Ludwig
Copyright
© 2012 RejectedSoftware e.K.
License
Subject to the terms of the MIT license, as written in the included LICENSE.txt file.