Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6e897c8

Browse files
NathanQingyangXuvbabaninkatcharov
authored
$dateToString aggregation with timezone outputs invalid ISO8601 string (#1768)
JAVA-5044 --------- Co-authored-by: Viacheslav Babanin <slav.babanin@mongodb.com> Co-authored-by: Maxim Katcharov <maxim.katcharov@mongodb.com>
1 parent 94aca5e commit 6e897c8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

‎driver-core/src/main/com/mongodb/client/model/mql/MqlExpression.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.util.function.BinaryOperator;
2929
import java.util.function.Function;
3030

31+
import static com.mongodb.assertions.Assertions.fail;
3132
import static com.mongodb.client.model.mql.MqlValues.of;
3233
import static com.mongodb.client.model.mql.MqlValues.ofNull;
3334
import static com.mongodb.client.model.mql.MqlValues.ofStringArray;
@@ -953,6 +954,12 @@ public MqlString asString(final MqlString timezone, final MqlString format) {
953954
.append("timezone", toBsonValue(cr, timezone))));
954955
}
955956

957+
public MqlString asString(final MqlString timezone) {
958+
// Given that server versions < 7.1 return a wrong format, not implementing this method helps prevent users
959+
// from encountering the bug, described in DRIVERS-2620, by avoiding the method that requires a format as a parameter.
960+
throw fail();
961+
}
962+
956963
@Override
957964
public MqlDate parseDate(final MqlString timezone, final MqlString format) {
958965
Assertions.notNull("timezone", timezone);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /