Made encoder more generic to accept BSON::Types but decoder returns as usual