Notes on the BSON encoding algorithm