use bson encode from https://github.com/tcoram/bson-lua