How could I write a BsonDocument object into a file, and read it again, using Java
问题 I want to output a BsonDocument to a file system, not to mongodb, and read it again using java. But current BasicBSONEncoder only support BSONObject which is the old version.How can I encode BsonDocument into binary? Or is there any way I can convert BsonDocument into BSONObject? 回答1: The eaziest is to convert the BSON to JSON and use java.io API's to write these data to files. The reverse would be to use Reader API's (BufferedReader or FileReader) to read these back and convert to BSON. Now