For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
Docs Menu

Release Notes

Learn what's new in:

Important

The Kotlin driver 5.11.1 includes fixes for the following CVEs:

For the latest information about MongoDB security updates, see MongoDB Security Bulletins.

To learn more about this release, see the v5.11.1 Release Notes on GitHub.

The 5.11 driver release does not include any changes, fixes, or features that apply to the Kotlin driver.

To learn more about this release, see the v5.11 Release Notes on GitHub.

The 5.10 driver release includes the following changes, fixes, and features:

  • Fixes an issue where a ByteArray field in a Kotlin data class was encoded as a BSON array of Int32 values instead of BSON Binary, which could significantly increase document size. This release restores BSON Binary encoding, matching the behavior before v5.1.3. The driver still decodes data written in the array format, but any non-driver consumers of this data might require updates to handle the new encoding.
  • Adds the $scoreFusion aggregation stage, which combines and normalizes the scores of multiple search pipelines. This stage requires MongoDB 8.2 or later.

  • Adds a fluent builder API for the $score aggregation stage. Use this API to configure score normalization, weighting, and score details. This feature requires MongoDB 8.2 or later.

  • Adds the parentFilter and nestedOptions options, which allow nested embeddings and arrays of embeddings in $vectorSearch queries.

To learn more about this release, see the v5.10 Release Notes on GitHub.

The 5.9.2 driver patch release includes the following changes:

To learn more about this release, see the v5.9.2 Release Notes on GitHub.

The 5.9 driver release includes the following changes, fixes, and features:

  • Promotes Queryable Encryption (QE) prefix, suffix, and substring queries to general availability (GA). These query types are supported on MongoDB 9.0 and later. To learn more about QE, see In-Use Encryption.

  • Renames the explicit encryption API for QE string queries from Text to String. To perform a QE string query, make the following changes:

    • Use the StringOptions class instead of TextOptions.

    • Use the EncryptOptions.stringOptions() method instead of textOptions().

    • Use the EncryptOptions.getStringOptions() method instead of getTextOptions().

    • Set the encryption algorithm to "String".

  • Upgrades the libmongocrypt version to 1.20.0.

To learn more about this release, see the v5.9 Release Notes on GitHub.

The 5.8 driver release includes the following changes, fixes, and features:

To learn more about this release, see the v5.8 Release Notes on GitHub.

The 5.7.1 driver patch release includes the following changes:

  • Fixes Javadoc warnings in the Micrometer integration.

  • Marks Micrometer OSGi imports as optional to resolve bundle resolution issues in OSGi runtime environments.

To learn more about this release, see the v5.7.1 Release Notes on GitHub.

The 5.7 driver release includes the following changes, fixes, and features:

The 5.6 driver release includes the following changes, fixes, and features:

  • Adds experimental support for Queryable Encryption prefix, suffix, and substring queries. To learn more about QE, see In-Use Encryption.

    Note

    Experimental Feature

    Queryable Encryption prefix, suffix, and substring queries are unstable, and their security is not guaranteed until they're generally available (GA). Use them in experimental workloads only.

  • Adds an nsType field to ChangeStreamDocument objects. This field contains the namespace type (COLLECTION, TIMESERIES, or VIEW) of the change event.

  • Adds experimental client-side operation timeout (CSOT) support for OIDC authentication.

    Note

    Experimental Feature

    The CSOT feature is experimental and might change in future driver releases.

  • When timeoutMS is set for CSOT, the driver ignores the value of the maxWaitTime connection setting.

  • Adds an appendMetadata() method to the MongoClient class. You can use this method to append metadata to an existing client's metadata. The maximum metadata size is 512 MB.

  • Adds a public constructor to the RewrapManyDataKeyOptions class.

  • Merges the AsyncReadOperation and AsyncWriteOperation interfaces into the ReadOperation and WriteOperation interfaces. You can create read and write operations by using builder methods in the Operations class.

  • Deprecates the MongoNamespace.COMMAND_COLLECTION_NAME constant.

  • Fixes a bug that prevented OIDC reauthentication within a session.

  • When serializing a POJO annotated with @BsonDiscriminator, if the property's readName matches the discriminator key, the driver serializes the field only once.

  • After you call the next() or tryNext() method on a CommandCursorResult instance, the driver clears the CommandCursorResult.results property to free memory.

  • The PojoBuilderHelper class creates property models that include properties from abstract classes and interfaces.

  • The driver publishes and logs the following events when the cluster topology changes:

    • ClusterOpeningEvent: Published when the topology opens

    • ClusterDescriptionChangedEvent: Published when the topology description changes

    • ClusterClosedEvent: Published when the topology closes

  • The driver throws a MongoStalePrimaryException when the primary replica set member becomes stale for one of the following reasons:

    • A new primary member is elected or discovered.

    • The value of the electionId or setVersion field in the primary member doesn't match the values of these fields in the other replica set members.

    To learn more about replica sets, see Replication in the MongoDB server manual.

The 5.5.1 driver patch release includes the following changes:

Important

Removal of Support for MongoDB server 4.0

Kotlin driver v5.5 removes support for MongoDB server 4.0. To learn more about compatible versions of the server, see Compatibility.

The 5.5 driver release includes the following changes, fixes, and features:

  • Adds support for the connectTimeoutMS option when using the default TLS transport layer.

The 5.4 driver release includes the following changes, fixes, and features:

  • Adds BsonConfiguration support for bson-kotlinx snake case conversion during serialization. To learn more, see the Implement Snake Case Naming Strategy section on the Serialization page.

The 5.3 driver release includes the following new features, improvements, and fixes:

  • Support for using builders class methods directly with data class properties. To learn more, see the Use Builders with Data Classes guide. This functionality is supported by the Kotlin driver Extensions package published with this release.

  • Implements a client bulk write API that allows you to perform write operations on multiple databases and collections in the same call. To learn more about this feature, see the Client Bulk Write section of the Bulk Operations guide.

Important

Removal of Support for MongoDB server 3.6

Kotlin driver v5.2 removes support for MongoDB server 3.6. To learn more about compatible versions of the server, see Compatibility.

The 5.2 driver release includes the following new features, improvements, and fixes:

  • Adds support for serializers from the kotlinx-datetime library that let you map Kotlin date and time types to BSON as the expected types instead of as strings. To learn more, see the Serialize Dates and Times section of the Kotlin Serialization guide.

  • Supports serialization of JsonElement values. To work with the JsonElement type, you must add the kotlinx-serialization-json library as a dependency in your application.

The 5.1.3 driver patch release includes the following changes:

The 5.1.2 driver patch release includes the following changes:

  • Support for encoding Kotlin data classes with nullable generic parameter types. For example, you can encode the Container class in the following code:

    @Serializable
    data class Box<T>(
    val boxed: T
    )
    @Serializable
    data class Container(
    val box: Box<String?>
    )

The 5.1.1 driver patch release includes the following changes:

  • When using the MONGODB-OIDC authentication mechanism, you must not include comma characters in the authMechanismProperties connection string value. To learn more about this behavior, see the MONGODB-OIDC section of the Enterprise Authentication guide.

Warning

Deprecations in this release

To avoid breaking changes in future major releases of the driver, replace any application code that depends on deprecated program elements.

This section includes the following information:

  • Support for MongoDB server v3.6 is deprecated and will be removed in the next driver version release. To learn how to upgrade your MongoDB server deployment, see Release Notes in the MongoDB server manual.
  • Internal testing of GraalVM native image technology. These tests involve building native applications by using the GraalVM native-image tool.

  • Enhanced support for the MONGODB-OIDC authentication mechanism. To learn more about OIDC, see the OIDC (Workload Identity Federation) section of the Enterprise Authentication Mechanisms guide.

  • Fixes an issue in which operations used the incorrect codec when using a polymorphic MongoCollection instance. This ensures that discriminator information is not lost when using bson-kotlinx.

  • Fixes an issue in which the class discriminator was the first field when decoding, resulting in field type errors when using a polymorphic MongoCollection instance.

  • Support for polymorphic serialization. To learn more, see the Polymorphic Serialization section of the Kotlin Serialization guide.

  • Introduces the serverMonitoringMode connection URI option. To learn more, see the Connection Options guide.

New features of the 5.0 driver release include:

  • The KotlinSerializerCodecProvider constructor now accepts serializersModule and bsonConfiguration objects:

    KotlinSerializerCodec.create(clazz.kotlin, serializersModule=serializersModule, bsonConfiguration=bsonConfiguration)

    This makes it easier to customize your configuration.

  • Fixes a Kotlin reflection bug that resulted in container type erasure.

This section includes the following information:

Warning

Deprecations in this release

To avoid breaking changes in future major releases of the driver, replace any application code that depends on deprecated methods and types.

The 4.11 driver release deprecates the following items:

  • The following network address-related methods are deprecated and will be removed in v5.0:

    • The ServerAddress methods getSocketAddress() and getSocketAddresses().

      Instead of getSocketAddress(), use the getByName() instance method of java.net.InetAddress.

      Instead of getSocketAddresses(), use the getAllByName() instance method of java.net.InetAddress.

    • The UnixServerAddress method getUnixSocketAddress().

      Instead of getUnixSocketAddress(), construct an instance of jnr.unixsocket.UnixSocketAddress. Pass the full path of the UNIX socket file to the constructor. By default, MongoDB creates a UNIX socket file located at "/tmp/mongodb-27017.sock". To learn more about the UnixSocketAddress, see the UnixSocketAddress API documentation.

  • The following methods and types related to the StreamFactory interface are deprecated and scheduled for removal in v5.0:

    • streamFactoryFactory() method from MongoClientSettings.Builder

    • getStreamFactoryFactory() method from MongoClientSettings

    • NettyStreamFactoryFactory class

    • NettyStreamFactory class

    • AsynchronousSocketChannelStreamFactory class

    • AsynchronousSocketChannelStreamFactoryFactory class

    • BufferProvider class

    • SocketStreamFactory class

    • Stream class

    • StreamFactory class

    • StreamFactoryFactory class

    • TlsChannelStreamFactoryFactory class

    If you configure Netty by using MongoClientSettings.Builder.streamFactoryFactory(), your code might resemble the following:

    import com.mongodb.connection.netty.NettyStreamFactoryFactory;
    // ...
    MongoClientSettings settings = MongoClientSettings.builder()
    .streamFactoryFactory(NettyStreamFactoryFactory.builder().build())
    .build();

    Replace this code with the TransportSettings.nettyBuilder() as shown in the following example:

    import com.mongodb.connection.TransportSettings;
    // ...
    MongoClientSettings settings = MongoClientSettings.builder()
    .transportSettings(TransportSettings.nettyBuilder().build())
    .build();

New features of the 4.11 driver release include:

  • Support for connecting to MongoDB by using a SOCKS5 proxy.

  • Added the getSplitEvent() method to the ChangeStreamDocument class to identify fragments of a change stream event that exceeds 16MB. You must use the aggregation stage $changeStreamSplitLargeEvent in your change stream to handle events that exceed 16MB.

  • Added an aggregation stage builder for $vectorSearch.

  • Added MongoDB Search index management helpers.

  • Updated Snappy and Zstd compression library dependency versions. To learn more about the current dependency versions, see Compress Network Traffic.

  • Added getElapsedTime() methods to the following classes to monitor the duration of connection pool events:

  • Support for Java 21 virtual threads and structured concurrency. The driver internals were updated to avoid unnecessary pinning of virtual threads and to preserve interrupted status of a thread, as the latter matters for structured concurrency where it is used for cancellation.

    To learn more about virtual threads, see the Virtual Threads JDK enhancement proposal. To learn more about structured concurrency, see the Structured Concurrency JDK enhancement proposal.

  • Updated API documentation for the following types:

Important

Starting in version 4.10.1 of the Kotlin driver, you must add the bson-kotlinx library as an explicit dependency to use the kotlinx-serialization library.

  • Support for Kotlin server-side usage, both for coroutines and for synchronous applications.

  • Codec support for Kotlin data classes.

  • Support for the kotlinx.serialization library