Custom BSON serialization Ruby

106 Views Asked by At

How to implement custom BSON serialization for a class in Ruby using the Mongo Ruby Driver ?

There is an as_extended_json method in BSON::Object module, mentioned in https://www.rubydoc.info/github/mongodb/bson-ruby/BSON%2FObject:as_extended_json

I tried to include this module and override this method, but it does not get called automatically, while inserting the object in the Mongo database.

Can you even override a module method in an including class ?

0

There are 0 best solutions below