-
Type: Improvement
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: 1.9.2
-
Component/s: C Extensions
-
None
Right now, there is a defined list of types that can be converted to BSON by the bson_ext gem. It would be very nice to be able to pass in custom objects, so long as they responded to some method that would return a more basic object that could be rendered into BSON directly.
For instance, having an object that returns a hash would then allow the object to be rendered into BSON.
I know the reverse is not true – but often there are good reasons to embed hashes and arrays into an object, but ultimately all it is doing is wrapping some control structure around that hash or array. And ultimately, I just want that data to be rendered, and on retrieval, flattening to its basic type is perfect.