This commit is contained in:
Jim Menard 2009-01-15 11:31:39 -05:00
parent 123b2c8d78
commit 08b1f64525

View File

@ -157,6 +157,10 @@ class DBAPITest < Test::Unit::TestCase
docs = @coll.find({'a' => { '$lt' => 10 }}, :sort => []).to_a docs = @coll.find({'a' => { '$lt' => 10 }}, :sort => []).to_a
assert_equal 4, docs.size assert_equal 4, docs.size
# Sorting using array of hashes; no order guarantee but should not blow up.
docs = @coll.find({'a' => { '$lt' => 10 }}, :sort => [{'b' => 1}, {'a' => 1}]).to_a
assert_equal 4, docs.size
# Sorting using ordered hash. You can use an unordered one, but then the # Sorting using ordered hash. You can use an unordered one, but then the
# order of the keys won't be guaranteed thus your sort won't make sense. # order of the keys won't be guaranteed thus your sort won't make sense.
oh = OrderedHash.new oh = OrderedHash.new