bson: EncodeInterface & tests

EncodeInterface function is needed for bsongen.