Skip to content

0.32.0 • The Unified API, $lookup and date-time aggregation operators

The Unified API

Since the start of the project, KtMongo only contained collection types (MongoCollection) and no database or client types. With this version, we're introducing MongoClient and MongoDatabase.

Along with this change, the two KtMongo drivers are tested under the same integration test suite, both with KotlinX.Serialization and with reflection. This will ensure we can catch differences earlier.

Breaking changes: with the occasion of the Unified API, some types have been renamed:

  • opensavvy.ktmongo.coroutines.JvmMongoCollectionopensavvy.ktmongo.coroutines.CoroutineMongoCollection
  • opensavvy.ktmongo.sync.JvmMongoCollectionopensavvy.ktmongo.sync.SyncMongoCollection
  • Similar renaming for JvmMongoIterable

Soon, the Multiplatform driver will join both official drivers to follow the same API.

  • Created the new :driver-api module with common documentation (#129, !259, !260, !262, !263, !276)
  • :driver-coroutines now follows the Unified API (!259, !260, !263)
  • :driver-sync now follows the Unified API (!277)

Drivers

  • Fixed MongoCollection.asOfficial() which returned a collection not aware of Kotlin types (4a75b28c)
  • Fixed deleteMany which only deleted one document (07d82316)

DSL

  • Improved compilation errors when the types are incorrect for update operations (!269, with help from the Kotlin team!)
  • Added the matchExpr aggregation stage as syntax sugar for $match { $expr: { … } } (3a704e4c)
  • Added direct array item access in projections (c29fc188)
  • Added the $lookup aggregation stage with all its options (!271)
  • Added the datetime aggregation operators: $year, $week, $second, $month, $minute, $millisecond, $isoWeek, $isoWeekYear, $isoDayOfWeek, $hour, $dayOfMonth, $dayOfWeek and $dayOfYear (!274)

Multiplatform

  • Improvements to the closing of the client (!261, !272)
  • Precise timing logs (5fa463d0)

Documentation

  • Added the Quick navigation page which makes it easier to find specific operators (!275)
  • The modules :driver-multiplatform and :driver-multiplatform-wire are now included in the Reference (!258)

Dependencies

  • Kotlin 2.4.10
  • KotlinX.Coroutines 1.11.0
  • KotlinX.Serialization 1.11.0
  • KotlinX.IO 0.9.1
  • Ktor 3.5.1
  • Slf4j 2.0.18
  • MongoDB JVM Driver 5.9.1
  • KMongo 5.6.0

Browse the documentation for this versionView release in GitLab