On this page
Learn what's new in:
The 4.8 driver ends support for MongoDB v3.4 and earlier. To learn more about breaking changes in this driver version and how to address them, see Version 4.8 Server Release Support Changes.
RecordCodecnow deserializes POJOs and record classes that are specified as type parameters of
Mapfields of a record as their respective classes. To learn more about this change and how this may affect the behavior of your application, see Version 4.8 Breaking Changes.
Behavioral changes with the 4.8 driver release include:
Requirement that you add an explicit dependency on the
org.bson.codecs.recordmodule if your application deploys the driver in an OSGi container and relies on the driver for encoding and decoding Java records.
Logging of new connection messages at the
DEBUGlevel instead of at
New features of the 4.8 driver release include:
Added support for authentication with AWS. The driver takes an optional dependency on both AWS SDK version 1 and version 2.
Support for obtaining credentials from the environment for both GCP and Azure for in-use encryption.
Support for deserialization of records containing components with generic parameters.
Support for deserialization of records containing components with more specific container types, such as
Support for recursive record types, records whose type definitions contain cycles.
The 4.7.1 driver patches a bug that affects
Client-Side Field Level Encryption and Queryable Encryption.
The bug can cause data corruption when rotating Data Encryption Keys
(DEKs) encrypted with a Customer Master Key
hosted on Google Cloud Key Management Service or Azure
Key Vault. The bug was present in version 4.7.0 of the driver
RewrapManyDataKey method and causes the
loss of your DEKs.
Back Up your Key Vault Collection
Always back up your Key Vault Collection before you rotate your DEKs. If you lose your DEKs, you lose access to all the data encrypted with those keys.
New features of the 4.7 driver release include:
Added full support for MongoDB 6.0.
Added the following change stream support improvements:
Enhanced pre-image and post-image support for change streams. Change stream watch helpers now accept
fullDocumentoption. See the change stream reference documentation for more information.
Added a new
fullDocumentBeforeChangeoption, which accepts
Change events now include a
fullDocumentBeforeChangefield when configured for display on your MongoDB collection.
showExpandedEventssupport for change streams.
wallTimesupport to the
Added clustered index creation support.
Support for new features related to Queryable Encryption, including support for automatic encryption (MongoDB v6.0 Enterprise or later is required) and manual encryption.
Support for the new Queryable Encryption shared library, which removes the need for the
mongocryptdprocess. The queryable encryption shared library requires org.mongodb:mongodb-crypt version
Added a new API for encryption key management.
BsonExtraElementsannotation that can be used with POJO encoding and decoding.
BsonExtraElementsenables decoding objects that may receive new fields in the future without requiring developers to explicitly map those new fields.
Performance optimizations including:
Lock-free implementations of the server session pool and the buffer pool.
A new cleanup implementation of
DBCursorthat uses Java's Cleaner API instead of finalization, available in Java 9 or later.
New features of the 4.6 Java driver release include:
The buffer pool is now shared across all
MongoClientinstances. The buffer pool prunes buffers that have been idle for one minute.
Added an API to specify suppliers for AWS KMS credentials for Client-Side Field Level Encryption (CSFLE). See the AutoEncryptionSettings.Builder.kmsProviderPropertySuppliers() and the ClientEncryptionSettings.Builder.kmsProviderPropertySuppliers() API documentation for more information.
Added compatibility to
org.mongodb:mongodb-crypt, a dependency for CSFLE, for Apple M1 ARM-based hardware.
New features of the 4.5 Java driver release include:
Added support for specifying custom service names of SRV resource records. See the
srvServiceNamesetting in the Connection Options guide for more information.
Added support to customize UUID representation in a codec registry using the
Added support for overriding listener settings in
All events received by
ServerMonitorListenerare now totally ordered using a happens-before relationship when the listeners are not shared by different MongoClient instances. To learn more about the happens-before ordering, see Happens-before Order in the Java Language Specification.
EnumCodecProviderclasses to separate codec support for
enumtypes from the
PojoCodecclass. The default codec registries, accessible from the
Bsoninterfaces, now include the
enumcodec classes. If your application uses a custom enumeration codec and one of the default registries, ensure you order them as described in the section on overriding codecs.
Resolved performance issues that impacted versions 4.4 and 4.3 of the driver. Performance in this version should be similar to performance in 4.2.
Resolved an issue in which errors originating from retrieving the cluster description weren't passed to the
Resolved an issue with releasing
ByteBufinstances when you connect with compression enabled.
Removed an unnecessary dependency on the
javax.annotation.*packages from the
New features of the 4.4 Java driver release include:
Compatibility with MongoDB 5.1 and support for Java 17
Added support for index hints in an
Added support for the
$outaggregation stages on secondaries
Use of the
mergeObjects()method in the
DocumentCodecdoes not ignore a CodecRegistry when writing to an
New features of the 4.3 Java driver release include:
Added support for the MongoDB Stable API. For more information, see our Stable API guide.
Starting from February 2022, the Versioned API is known the Stable API. All concepts and features remain the same with this naming change.
Added a builder API for the
setWindowFieldspipeline stage to allow the use of window operators
Added support for setting Netty io.netty.handler.ssl.SslContext
Added support for snapshot reads to
Limited the rate of establishing new connections per connection pool
Removed most restrictions on allowed characters in the field names of documents you insert or replace. This is a behavioral change for any application that is relying on client-side enforcement of these restrictions.
The following table shows the restriction status on allowed characters in the field names of documents:
Insert and Replace
Removed restrictions on field names containing this character.
Removed restrictions on field names starting with this character.
Removed restrictions in nested documents on field names containing this character.
Kept restrictions in top-level documents on field names starting with this character. This prevents accidental use of a replace operation when the intention was to use an update operation.
Unacknowledged writes using dollar-prefixed or dotted keys may be silently rejected by pre-5.0 servers, where some restrictions on field names are still enforced in the server.
New features of the 4.2 Java driver release include:
Added Azure and GCP key stores to client-side field level encryption
Added Kerberos caching tickets for reuse in multiple authentication requests- Added MongoClients instances with
ConnectionStringas the configuration
Added a JsonObject class to make encoding from and decoding to JSON more efficient by avoiding an intermediate Map representation
Added a Filters.empty() method
There are breaking changes that may affect your application. See the Upgrading Guide for more information.
New features of the 4.1 Java driver release include:
Significant reduction in client-perceived failover times during planned maintenance events
find()method supports allowDiskUse() for sorts that require too much memory to execute in RAM
Added support for the MONGODB-AWS authentication mechanism using Amazon Web Services (AWS) Identity and Access Management (IAM) credentials
Authentication requires fewer round trips to the server, resulting in faster connection setup
This release adds no new features.