diff --git a/driver-core/src/main/com/mongodb/client/model/mql/MqlDate.java b/driver-core/src/main/com/mongodb/client/model/mql/MqlDate.java index b6600aaf68..63637df688 100644 --- a/driver-core/src/main/com/mongodb/client/model/mql/MqlDate.java +++ b/driver-core/src/main/com/mongodb/client/model/mql/MqlDate.java @@ -138,6 +138,20 @@ public interface MqlDate extends MqlValue { */ MqlString asString(MqlString timezone, MqlString format); + /** + * The string representation of {@code this} date as determined by the + * provided {@code timezone} with default format as below: + * + * + * + * @param timezone the UTC Offset or Olson Timezone Identifier. + * @return the resulting value. + */ + MqlString asString(MqlString timezone); + /** * The result of passing {@code this} value to the provided function. * Equivalent to {@code f.apply(this)}, and allows lambdas and static, diff --git a/driver-core/src/main/com/mongodb/client/model/mql/MqlExpression.java b/driver-core/src/main/com/mongodb/client/model/mql/MqlExpression.java index eb7ea9a68c..56108fb143 100644 --- a/driver-core/src/main/com/mongodb/client/model/mql/MqlExpression.java +++ b/driver-core/src/main/com/mongodb/client/model/mql/MqlExpression.java @@ -28,6 +28,7 @@ import java.util.function.BinaryOperator; import java.util.function.Function; +import static com.mongodb.assertions.Assertions.fail; import static com.mongodb.client.model.mql.MqlValues.of; import static com.mongodb.client.model.mql.MqlValues.ofNull; import static com.mongodb.client.model.mql.MqlValues.ofStringArray; @@ -953,6 +954,10 @@ public MqlString asString(final MqlString timezone, final MqlString format) { .append("timezone", toBsonValue(cr, timezone)))); } + public MqlString asString(final MqlString timezone) { + throw fail(); // intentionally not implemented, see DRIVERS-2620 + } + @Override public MqlDate parseDate(final MqlString timezone, final MqlString format) { Assertions.notNull("timezone", timezone);