Docs Menu

Docs HomeKotlin Coroutine

Migrate from KMongo

On this page

  • Overview
  • Connect to MongoDB Cluster
  • CRUD and Aggregation
  • Construct Queries
  • Data Typing
  • Data Serialization
  • Synchronous and Asynchronous Support
  • What Next?

This page contains a high-level comparison of most of the ways the official MongoDB Kotlin and the community-developed KMongo driver differ. You can use this page to identify the changes you need to make to migrate from the deprecated KMongo driver to the official MongoDB Kotlin driver.

KMongo is a popular community-developed library for working with MongoDB from Kotlin applications. It is a wrapper around the Java driver that was created prior to the creation of the official Kotlin driver to serve the needs of the Kotlin community.

Important

As of July 2023, KMongo has been marked as deprecated.

The MongoDB Kotlin driver is the officially supported and maintained MongoDB driver for Kotlin. It is developed by the MongoDB team.

Although both drivers support synchronous and asynchronous operations, the examples on this page will use asynchronous coroutine-based operations.

Both drivers let you connect to and communicate with MongoDB clusters from a Kotlin application.

Both drivers provide support for all MongoDB CRUD APIs and aggregation operations.

Both drivers provide support for type-safe queries using property references.

Both drivers support the use of Kotlin data classes as well as the Document class to model the data stored in a MongoDB collection. The Document class lets you model data represented in a MongoDB collection in a flexible format.

Both drivers provide support for serializing and deserializing data objects in Kotlin to and from BSON.

Both drivers support synchronous and asynchronous operations.

Now that you have learned about the differences between KMongo and the MongoDB Kotlin driver, see the Quick Start to get started using the KMongo Kotlin driver.

←  Compatibility