Skip to content

2026

0.27.0 • Update return type, Java document conversions and improved documentation

BSON

  • Improved the documentation of ObjectId and ObjectIdGenerator (#109, 1c2765f4, !198)
  • Improved the documentation of ObjectId.Serializer and Timestamp.Serializer (#108, !199)
  • Fixed documentation mistakes regarding the bounds of ObjectId (0055e7a6, !198)

BSON (official)

  • Added JvmBsonFactory.readDocument(), readArray() and readValue() to convert from official types to their KtMongo equivalents (bce89d5b)

DSL

  • Added Field<T, V>.toBsonPath() (#113, !201)

Drivers

  • Added UpdateResult and UpsertResult, the return types of updateOne, updateMany, upsertOne and their aggregation equivalents (#110, !197)

Dependencies

  • Kotlin 2.3.10

0.26.2 • KotlinX.Serialization unity

BSON (Official)

The MongoDB official driver has two main serialization modes: :bson-kotlin (based on reflection) and :bson-kotlinx (based on KotlinX.Serialization). These two systems serialize objects slightly differently.

Most notably, the newly-added types kotlin.time.Instant and kotlin.uuid.Uuid are both serialized by :bson-kotlinx as strings, but are serialized to the corresponding BSON type by :bson-kotlin. This release introduces the serializers InstantAsBsonDatetimeSerializer and UuidAsBsonBinarySerializer which use the BSON type no matter what serialization library is used, but also support JSON serialization as strings. Users have to enable them explicitly (see their documentation to learn how).

In this version, we also ensured that the KtMongo types (ObjectId and Timestamp) are serialized correctly using both serialization strategies.

0.26.0 • BSON equality and diffing, expanded BsonPath, Java driver, and improved documentation

BSON

  • Added equals and hashCode implementations for all BSON types, to allow checking if two BSON documents are identical (a073e815, !176)
  • Added BsonDocumentReader.names to iterate the field names (d26da4fb, !184)
  • Added BsonArrayReader.indices and .size to iterate over elements (ea9e5817, 3b354010, !184)
  • The official and multiplatform implementations are now tested with the same suite (bba1d7bf, !173)
  • Fixed broken documentation links in Bson and BsonArray (d265b02b)
  • Improved the documentation of BsonType (3da19f42, !185)
  • Explicitly document that BsonType.ordinal shouldn't be used (4ef5848e, !185)

BSON (official)

  • Fixed BsonValueReader.read when reading a primitive JVM type (fbdfd880)
  • Fixed BsonValueReader.toString() which did not return a JSON representation (19a34ea5)

BSON (multiplatform)

  • Fixed thread safety issue in Bson.eager() and BsonArray.eager() (#102, !179)

BsonPath

  • Renamed the parsing method from BsonPath.parse("$.a") to BsonPath("$.a") (30a09f83, #93, !165)
  • Add Bson.select("$.a") as a shorthand for Bson.select(BsonPath("$.a")) (a7b68c1a, #93, !165)
  • Add support for BsonPath.all/$.* (5e8db0f2, #93, !165)
  • Add support for BsonPath.sliced/$[1:5:2] (10f2c1c5, #93, !165)
  • Add support for BsonPath[-1]/$[-1] (01a0781f, #93, !165)
  • Add support for BsonPath.any()/$["foo", "bar"] (895c2fda, #93, !182)
  • Improve testing of BsonPath expressions

BSON diff

  • Add doc1 diff doc2 to display a human-readable difference of two BSON values, primarily intended for tests (#98, !177)

Java driver

  • Fixed publishing issue. The Java module should now be published alongside all other modules (!180)

Documentation

  • Improved the module-level documentation for all modules (#88, !181)