Docs Menu

Docs HomeDevelop ApplicationsMongoDB DriversJava Sync

What's New

On this page

  • Upcoming Breaking Changes
  • What's New in 4.5.1
  • What's New in 4.5
  • What's New in 4.4
  • What's New in 4.3
  • What's New in 4.2
  • What's New in 4.1
  • What's New in 4.0

Learn what's new in:

  • MapReduceIterable and map-reduce methods on MongoCollection are deprecated in MongoDB v4.2 and later. They will be replaced by the aggregation framework and removed in a future release.

If the DNS server returns an NXDomain error, indicating a non-existent domain, the 4.5.1 driver no longer throws an exception.

New features of the 4.5 Java driver release include:

  • Added support for specifying custom service names of SRV resource records. See the srvServiceName setting in the Connection Options guide for more information.

  • Added support to customize UUID representation in a codec registry using the CodecRegistries.withUuidRepresentation() method.

  • Added support for overriding listener settings in ClusterSettings, ServerSettings and ConnectionPoolSettings builders.

  • All events received by ClusterListener, ServerListener, and ServerMonitorListener are 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.

  • Added EnumCodec and EnumCodecProvider classes to separate codec support for enum types from the PojoCodec class. The default codec registries, accessible from the MongoClientSettings and the Bson interfaces, now include the enum codec 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 onError Subscriber callback

  • Resolved an issue with releasing ByteBuf instances when you connect with compression enabled.

  • Removed an unnecessary dependency on the javax.annotation.* packages from the org.mongodb.driver-core OSGi bundle.

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 AggregateIterable

  • Added support for the $merge and $out aggregation stages on secondaries

  • Use of the mergeObjects() method in the Updates builder

  • DocumentCodec does not ignore a CodecRegistry when writing to an Iterable or a Map instance

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.

    Note

    Starting from February 2022, the Versioned API is known the Stable API. All concepts and features remain the same with this naming change.

  • Added support for connection to MongoDB Atlas Serverless Instances. For more information on setup, see our documentation on how to Create a New Serverless Instance

  • Added a builder API for the setWindowFields pipeline stage to allow the use of window operators

  • Added support for setting Netty io.netty.handler.ssl.SslContext

  • Added support for snapshot reads to ClientSession

  • 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:

Character
Operation
Description
.
Insert and Replace
Removed restrictions on field names containing this character.
$
Insert
Removed restrictions on field names starting with this character.
$
Replace
Removed restrictions in nested documents on field names containing this character.
$
Replace
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.

Note

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.

Warning

Breaking Changes in v4.2

The v4.2 driver contains breaking changes. See Version 4.2 Breaking Changes for more information.

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 MongoClientSettings or ConnectionString as the configuration

  • Use of the explain() method on find and aggregate commands

  • Added a JsonObject class to make encoding from and decoding to JSON more efficient by avoiding an intermediate Map representation

  • Added a BsonRepresentation annotation that allows you to represent the ObjectId BSON values as a String in POJO classes

  • Added a Filters.empty() method

New features of the 4.1 Java driver release include:

  • Significant reduction in client-perceived failover times during planned maintenance events

  • The update() and delete() methods now support index hints

  • The 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

Warning

Breaking Changes in v4.0

The v4.0 driver contains breaking changes. See Version 4.0 Breaking Changes for more information.

This release adds no new features.

←  Quick ReferenceUsage Examples →