mongoid/mongoid — pull request #1575 by bcassell (2012-01-10 03:01:07+00:00)
Title: sorting option for Hash fields

This pull request addresses https://github.com/mongoid/mongoid/issues/1572

This pull request adds a "sorted" option for Hash fields. When :sorted => true, Hash fields are completely sorted on storage and search. This way mongoid can support ruby's definition of Hash equality, i.e.

{"A" => 1, "B" => 2} == {"B" => 2, "A" => 1}

even though mongodb does not.

I'm not sure I've done all of the appropriate testing necessary, because of how large the codebase is, and how new I am to it. In particular I'm not sure what I need to do to restrict this option to Hashes, or where the tests for that should reside.

If this would be better suited as a gem, let me know. I'm new to open source dev.