code: public String toJson(final JsonWriterSettings settings) {
          StringWriter writer = new StringWriter();
          new BsonDocumentCodec().encode(new JsonWriter(writer, settings), this, EncoderContext.builder().build());
          return writer.toString();
      }
docs: Gets a JSON representation of this document using the given {@code JsonWriterSettings}.
  @param settings the JSON writer settings
  @return a JSON representation of this document