copied docs from sort
This commit is contained in:
parent
d1e45fdb1a
commit
e6710621a7
@ -75,13 +75,12 @@ module Mongo
|
|||||||
|
|
||||||
# Sort the results of the query with a hash of keys and orders
|
# Sort the results of the query with a hash of keys and orders
|
||||||
#
|
#
|
||||||
# Sorts should be formed as such:
|
# Either hash of field names as keys and 1/-1 as values; 1 ==
|
||||||
# {:name=>-1} (sort by name, descending) OR {:name=>1} (sort by name, ascending)
|
# ascending, -1 == descending, or array of field names (all
|
||||||
# options are stackable, with the last option being the priority, i.e.:
|
# assumed to be sorted in ascending order).
|
||||||
# {:name => -1, :age => 1} (name descending, age asending)
|
def sort(order)
|
||||||
def sort(order_hash = {})
|
|
||||||
raise InvalidOperation, "can't call Cursor#sort on a used cursor" if @query_run
|
raise InvalidOperation, "can't call Cursor#sort on a used cursor" if @query_run
|
||||||
@query.order_by = OrderedHash[order_hash]
|
@query.order_by = order
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user