cargo mongodb 2.7.0-beta
v2.7.0-beta

latest releases: 3.1.0, 3.0.1, 3.0.0...
14 months ago

The MongoDB Rust driver team is pleased to announce the v2.7.0-beta release of the mongodb crate, now available for download from crates.io.

Highlighted Changes

BETA: Serialization Behavior Change

When serializing values via serde, the serializer can indicate whether or not the target format is human-readable, allowing types to change behavior based on that. The Rust driver had inadvertently been serializing values given to find_one_and_replace and replace_one as human-readible when all other methods serialize as non-human-readible; this bug is fixed in 2.7.0-beta, with those methods also serializing as non-human-readible.

However, it is potentially possible (if unlikely) that user code may rely on this bug, so out of an abundance of caution we are releasing this version as a beta. If your code does rely on human-readable serialization, you can specify that via the new human_readable_serialization field in CollectionOptions.

run_cursor_command

The Rust driver provides the run_command method as a way for users to directly send bson commands to the server; this is particularly useful when the driver does not yet have support for a newly-added server command. However, using this with commands that return a cursor requires re-implementing the logic for cursor iteration, which can be tedious and error-prone. The new run_cursor_command method avoids those problems, directly returning a Cursor using the same iteration logic as other methods.

SDAM Logging

The Rust driver will now log SDAM events when using the tracing-unstable feature.

Client Management

The Client type now provides three additional ways to shape behavior to fit your workload:

  • ClientOptions.max_connecting lets you specify how many "in flight" connections can be established in parallel. This was previously fixed at 2 and defaults to the same value.
  • Client::warm_connection_pool will create new connections to bring the connection pool up to min_pool_size, which can provide more predictable performance in some circumstances.
  • Client::shutdown will cleanly stop background tasks and wait for outstanding handles to be dropped. This is particularly useful when using event handlers that reference external resources, as otherwise those handlers may be invoked in a background task even after the Client has been dropped.

Included Changes

Below are a selected list of changes with user impact; for a full list of changes see this GitHub query.

New Features

Improvements

  • RUST-1433 Propagate original error for some labeled retry errors (#903)
  • minor: improve README.md (#934)
  • upgrade webpki (#935) (thanks @fuchsnj!)

Bugfixes

Don't miss a new mongodb release

NewReleases is sending notifications on new releases.