thetron / mongoid-enum

Sweet enum sugar for your Mongoid documents
MIT License
117 stars 165 forks source link

Symbol type is deprecated #41

Open jeremyhaile opened 8 years ago

jeremyhaile commented 8 years ago

The "symbol" type is deprecated in BSON and in Mongo 3.2. https://docs.mongodb.com/manual/reference/bson-types/

I believe mongoid-enum should be updated to use Strings instead of Symbols for storing the enum value to reduce future data migrations when Symbol is finally removed as a supported type.

Alternatively, mongoid-enum could be made to be indifferent as to whether strings or symbols are stored - including in the auto-generated accessor methods.

jnfeinstein commented 7 years ago

+1

We're trying to upgrade mongo, the export utility flat out refuses to handle symbol types. Any plan to tackle this?

On second thought, shouldn't mongoid silently handle this under the hood? If it accepts Symbol as a type it should know to encode as string and decode as symbol.

sujithsudarsanan commented 7 years ago

+1 Is there any solution for now?

jnfeinstein commented 7 years ago

Some additional insight, apparently the symbol type was deprecated in the BSON driver (masked to string) and specifically undeprecated by the official Ruby mongodb driver. Mongoid relies on the driver which relies on BSON. IMO this is beyond the scope of this project but is certainly an issue for anybody using mongoid. I'm currently unable to post evidence but will do so ASAP unless someone beats me to it.