Reputation: 28164
I noticed that mongodb allows for ordered hash, but i do not see documentation of that in mongoid:
How do we use this in mongoid?
Upvotes: 0
Views: 498
Reputation: 1044
All data in the mongodb ruby driver comes out as an OrderedHash. The OrderedHash mimics the BSON data structure of the database.
Unfortunately, you can't use the OrderedHash from within Mongoid because you have to map everything to Objects. However, you can get at the raw mongo collection by doing MyObject.collection.find({...}) and get at the OrderedHash that way.
Upvotes: 1