modified the encoder to enable ability to directly send bson data