From e74838af4813eb4fd7f19563c3b2df4709b3d3c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?= Date: Fri, 31 Jul 2026 10:15:29 +0200 Subject: [PATCH] upgrade: MongoDB JVM driver 5.9.1 The string representation of Double is slightly modified in this version: the sign of the exponent is displayed, where it wasn't previously. All KtMongo flavors are impacted to follow the same change. --- bson-multiplatform/src/commonMain/kotlin/BsonValue.kt | 2 +- bson-tests/src/commonMain/kotlin/types/DoubleTest.kt | 6 +++--- gradle/libs.versions.toml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bson-multiplatform/src/commonMain/kotlin/BsonValue.kt b/bson-multiplatform/src/commonMain/kotlin/BsonValue.kt index 1697f572..7fc04f10 100644 --- a/bson-multiplatform/src/commonMain/kotlin/BsonValue.kt +++ b/bson-multiplatform/src/commonMain/kotlin/BsonValue.kt @@ -299,7 +299,7 @@ class BsonValue internal constructor( if (abs(value) > 1_000_000.0) { val exponent = floor(log10(abs(value))).toInt() val scientific = value / 10.0.pow(exponent) - return """${scientific}E$exponent""" + return """${scientific}E+$exponent""" } var str = value.toString() diff --git a/bson-tests/src/commonMain/kotlin/types/DoubleTest.kt b/bson-tests/src/commonMain/kotlin/types/DoubleTest.kt index 211a84dd..82f6df7b 100644 --- a/bson-tests/src/commonMain/kotlin/types/DoubleTest.kt +++ b/bson-tests/src/commonMain/kotlin/types/DoubleTest.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, OpenSavvy and contributors. + * Copyright (c) 2025-2026, OpenSavvy and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -93,7 +93,7 @@ fun SuiteDsl.verifyDoubles(factory: Prepared) = suite("Double") { document { writeDouble("d", 1.2345678921232E+18) }, serialize(D(1.2345678921232E+18)), hex("100000000164002A1BF5F41022B14300"), - json("""{"d": 1.2345678921232E18}"""), + json("""{"d": 1.2345678921232E+18}"""), verify("Read value") { check(this["d"]?.decodeDouble() == 1.2345678921232E+18) } @@ -105,7 +105,7 @@ fun SuiteDsl.verifyDoubles(factory: Prepared) = suite("Double") { document { writeDouble("d", -1.2345678921232E+18) }, serialize(D(-1.2345678921232E+18)), hex("100000000164002A1BF5F41022B1C300"), - json("""{"d": -1.2345678921232E18}"""), + json("""{"d": -1.2345678921232E+18}"""), verify("Read value") { check(this["d"]?.decodeDouble() == -1.2345678921232E+18) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 959fa726..3f565734 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -10,7 +10,7 @@ io = "0.9.1" # https://github.com/Kotlin/kotlinx-io/releases ktor = "3.5.1" # https://ktor.io/docs/releases.html#release-details -mongodb-jvm = "5.6.2" # https://central.sonatype.com/artifact/org.mongodb/bson/versions +mongodb-jvm = "5.9.1" # https://central.sonatype.com/artifact/org.mongodb/bson/versions mongodb-js = "6.10.3" # https://www.npmjs.com/package/bson -- 2.51.2