I am trying to understand why Mongoid thinks 387 is less than 67. I have two entries and line 67 appears above line 387 each time. My request is simple
Building.desc(:violations)
I also tried order_by(), and this is the same story.
Edit:
Now I have changed the type of the field to Integer for some fields and to BigDecimal for other fields, where the numbers are larger - especially the currency digits. This fixed the Integer fields, but BigDecimal fields are still not sorted properly.
source
share