Skip to content

News

0.21.0 • $group and string aggregation operators

DSL

  • Projections are now represented with booleans instead of integers, for smaller request payloads (#81, !121)

Aggregation stages:

  • Added $group (!120)

Accumulation operators:

Aggregation operators:

  • Added $multiply, $divide and $subtract (!122)
  • Added $trim, $ltrim and $rtrim (!123)
  • Added $toLower and $toUpper (!123)
  • Added $substrCP, $substrBytes, $strLenCP and $strLenBytes (!123)
  • Added $split (!123)
  • Added $replaceOne and $replaceAll (!123)

Dependencies

  • KotlinX.Serialization 1.9.0
  • KotlinX.Coroutines 1.10.2
  • KotlinX.IO 0.8.0
  • MongoDB Java driver 5.5.1

0.19.0 • Pure Kotlin ObjectId and Timestamp, $switch, type aggregation operators, bitwise filter operators, writeConcern and readPreference

BSON

  • Moved ObjectId to opensavvy.ktmongo.bson.types (#6e455683, !80)
  • Added ObjectIdGenerator with multiple implementations (!80)
  • Added ObjectId.MIN and ObjectId.MAX (!80)
  • Added BsonContext.newId (!80)
  • Added BsonReader.readInstant and BsonWriter.writeInstant (#244237ed, !88)
  • Added opensavvy.ktmongo.bson.types.Timestamp (!89)
  • Changed timestamp APIs from Long to the new Timestamp type (!89)

BSON (official)

  • Deleted the old expect class opensavvy.ktmongo.bson.official.types.ObjectId (!80)
  • Added a codec for the new ObjectId (!80)

BSON (multiplatform)

  • Decreased data copying when reading data (#417128b5, !84)
  • Removed autoboxing in the implementation of the reader (#17cab93a, !84)
  • Added no-copy piping of BSON from a reader to a writer (!86)
  • Added support for reading and writing BsonType.DateTime as kotlin.time.Instant (#e15001f4, !88)
  • Added support for reading and writing BsonType.RegExp (#2bb5e544, !88)
  • Added support for reading and writing BsonType.Timestamp (#aa3c9a9e, !89)

Official driver

  • JvmMongoCollection.find now returns a JvmMongoIterable instead of a MongoIterable (!85)

DSL

  • Added the aggregation operator $switch (!90)
  • Added the aggregation operators $type, $isArray, $isNumber, $toBoolean, $toDate, $toDouble, $toInt, $toLong, $toObjectId, $toString and $toUUID (!91)
  • Added the filter operators $bitAllClear, $bitsAllSet, $bitsAnyClear and $bitsAnySet (!92)
  • Added the option writeConcern (!93)
  • Added the option readPreference (!94)
  • Created the Command interface and reorganized all commands to emit their BSON representation (!95)

Documentation

  • Added a section on aggregation support to the KMongo migration page (#87, !103)

Dependencies

  • Kotlin 2.2.0

0.18.0 • ObjectId, range operators, $min and $max, read concern and Java usage

BSON

  • Pure Kotlin ObjectId implementation (!72)
  • Added utilities for comparing ObjectId and Instant (!72)

DSL

Synchronous driver

  • Added a new experimental module, :driver-sync-java, with utilities for using KtMongo from Java (!69)
  • Java: Added JavaField.of(Customer::name) syntax (!69)
  • Java: Added KtMongo.from() helper (!69)
  • Java: Added options(s -> s.) syntax (!69)

Dependencies

0.15.0 • $regex flexibility, simpler options, Reader.toBson

DSL

  • Allow using $regex on a nullable String field (!59)
  • Rewrote the representation of options to make them simpler to evolve in the future (!61)

BSON

BSON (Multiplatform)

Documentation

  • Added a mention to $in and $nin in FilterQuery (#a1e04fe8, !57)
  • Fixed a broken sentence in BsonDocumentReader (#34ca574d, !57)
  • Added the Multiplatform BSON implementation to the API references (#888b31ce, !57)

0.14.0 • Start of the Multiplatform driver, the great rename, $nin and $regex

Breaking changes

This version contains a major rename that affects almost everything in the DSL module. To learn more about the reasons we did it, see #35 and !54. Although future versions may still have breakages, this was the last planned major change.

  • Renamed package models to command
  • Renamed package expr to query
  • Moved contents of package expr.common to tree
  • Moved contents of package options to command
  • Moved contents of package options.common to command
  • Renamed FilterOperators to FilterQuery, removed FilterExpression
  • Renamed PredicateOperators to FilterQueryPredicate, removed PredicateExpression
  • Renamed UpdateOperators to UpdateQuery, removed UpdateExpression
  • Renamed UpsertOperators to UpsertQuery
  • Renamed Expression (and its hierarchy) to BsonNode
  • Renamed ValueDsl to AggregationOperators

BSON

  • Added Bson.toByteArray() and BsonArray.toByteArray() to access the raw binary BSON representation (!49)
  • writeBinaryData's subtype parameter was changed from Byte to UByte to better mirror the BSON spec (!49)
  • Added BsonType.fromCode() to more easily access a BSON type from its binary representation (!50)
  • Added Bson.read() and BsonArray.read() to access contents of BSON objects (!50)
  • Added BsonContext.readDocument() and BsonContext.readArray() to convert from the binary BSON representation to driver objects (!50)
  • Documented that BSON-writeable objects much implement toString with a JSON representation (!54)

BSON (Official)

  • Removed the dependency on NPM bson since it is currently unused (!49)

BSON (Multiplatform)

This new module is a pure Kotlin implementation of the BSON spec (#48, #49).

  • Write booleans (!49) and read them (!50)
  • Write int32 and int64 (!49) and read them (!50)
  • Write strings (!49) and read them (!50)
  • Write documents (!49) and read them (!50)
  • Write doubles (!49) and read them (!50)
  • Write arrays (!49) and read them (!50)
  • Write binary data (!49)
  • Write JS (!49)
  • Write datetime (49)
  • Write null (!49) and read them (!50)

DSL

  • Added the filter operator $nin (!52)
  • Added the filter operator $regex (!56)
  • Added the convenience function BsonNode.toBson() (!54)

Synchronous driver

  • Moved UpdatePipelineOperators into the correct package (!54)

Deployment

  • The project is now tested with MongoDB versions 6.0.21, 7.0.18 and 8.0.6 (!53)

0.13.0 • Arbitrary BSON writers and parsers

BSON

The :bson module's documentation on the Kotlin MongoDB driver has been removed.

There are multiple breaking changes related to this refactor. For example, buildBsonDocument and buildBsonArray are now members of BsonContext instead of being top-level functions.

  • Everything but the interface definitions for arbitrary BSON writers and parsers has been removed from the :bson module
  • The BSON parser and writer based on the Kotlin MongoDB driver has been moved to the new module :bson-official (#67567b42)
  • BSON tests for parsers and writers have been moved to the new module :bson-tests (#5bef8c13)
  • Support most Kotlin platforms (#9af59a3b)

Annotations

DSL

  • Utilities related to the official MongoDB driver have been moved to the :driver-shared-official internal module (#404cbb38)

Documentation

  • Changed the Maven metadata from linking to the repository to linking to the documentation website (#8ca2a2df)