I wonder how to do multifield sorting in mongodb driver of ruby
Example of sorting from official site where we can find the following example:
# Sort in ascending order by :i
coll.find.sort(:i)
# Sort in descending order by :i
coll.find.sort(:i => :desc)
According to these examples I tired to do something like this
coll.find.sort(:i,:j)
and this is didn’t work
Do you know the right way to do multifield sorting in ruby driver.
after a short investigation the answer was found
we can use either
or
the first way with hash doesn’t work for me for some reason, but the second is completely ok