bson: EncodeInterface & tests

EncodeInterface function is needed for bsongen.
bson: fix typo
Merge branch 'bson'