Getting hash with symbol as keys for mongo in rails

前端 未结 2 1938
南笙
南笙 2021-01-18 20:07

The Mongo ruby driver seems to get put your results into a hash with strings as keys. Is there a way to tell it to convert the keys into symbols instead?

2条回答
  •  渐次进展
    2021-01-18 20:26

    According to the FAQ, Even though there is a symbol type in Mongo, and you can store symbols in values, the BSON format specifies that keys must be strings.

提交回复
热议问题