Description

OrderBy sorts the sequence by document values of the given key(s). To specify the ordering, wrap the attribute with either r.Asc or r.Desc (defaults to ascending).

Sorting without an index requires the server to hold the sequence in memory, and is limited to 100,000 documents (or the setting of the ArrayLimit option for run). Sorting with an index can be done on arbitrarily large tables, or after a between command using the same index.