Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-711

bson_ext could call ruby method to get a to_bson'able representation

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 12_01_17
    • 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.

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            skandragon Michael Graff
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: