mongoid / origin

A Ruby DSL for building MongoDB queries
http://mongoid.org/en/origin/index.html
MIT License
62 stars 29 forks source link

Add Sorting Options #27

Closed durran closed 12 years ago

durran commented 12 years ago

Add options for sorting:

Model.asc(:field)
Model.ascending(:field)
Model.desc(:field)
Model.descending(:field)
Model.order_by("field asc, other desc")
Model.order_by(:field.asc, :other.desc)
Model.order_by(field: :asc, other: :desc)
DouweM commented 12 years ago

If we're going to cover all bases, I'd add

Model.order_by(:field, :asc)

to the list.

durran commented 12 years ago

Sure thing.