Description
Currently it involves a lot of code:
BasicOutputBuffer buffer = new BasicOutputBuffer();
|
BsonBinaryWriter binaryWriter = new BsonBinaryWriter(buffer);
|
new DocumentCodec().encode(binaryWriter, document, EncoderContext.builder().build());
|
int bsonSize = binaryWriter.getBsonOutput().getSize();
|
Especially when compared to the legacy BSON way:
int bsonSize = BSON.encode(document).length;
|
Attachments
Issue Links
- duplicates
-
JAVA-1975 Add a toBson / fromBson helper to Document, DBObject and BsonDocument
-
- Backlog
-