code: public byte[] write( Object object ) throws IOException {
          BsonDataOutput buffer = new BsonDataOutput();
          write(null, object, buffer);
          ByteArrayOutputStream stream = new ByteArrayOutputStream(buffer.size());
          buffer.writeTo(stream);
          return stream.toByteArray();
      }
docs: Return the array of bytes containing the standard BSON binary form of the supplied in-memory {@link Document}.
  
  @param object the BSON object or BSON value; may not be null
  @return the bytes
  @throws IOException if there was a problem reading from the stream