After JAVA-4917, the internal classes internal ByteBufBsonDocument/ByteBufBsonArray offer even more overlapping, and now better, support for raw BSON. Consider DRY-ing up the code so that both offer the same functionality but with shared code. It might also be possible to replace the internal classes with the public ones.