Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ buildvariants:
SSL: ssl
tasks:
# Ubuntu 22.04 does not support MongoDB versions below 6.0.
- name: .standalone !.4.0 !.4.2 !.4.4 !.5.0
- name: .replicaset !.4.0 !.4.2 !.4.4 !.5.0
- name: .sharded !.4.0 !.4.2 !.4.4 !.5.0
- name: .standalone !.4.2 !.4.4 !.5.0
- name: .replicaset !.4.2 !.4.4 !.5.0
- name: .sharded !.4.2 !.4.4 !.5.0

- name: macos-14.00
display_name: "MacOS 14.00"
Expand Down Expand Up @@ -200,8 +200,8 @@ buildvariants:
tasks:
# The Stable API was introduced in MongoDB version 5.0. Drivers Evergreen Tools only supports
# setting REQUIRE_API_VERSION on standalones and sharded clusters.
- .standalone !.4.0 !.4.2 !.4.4
- .sharded !.4.0 !.4.2 !.4.4
- .standalone !.4.2 !.4.4
- .sharded !.4.2 !.4.4

- name: sync-api
display_name: "Sync API"
Expand Down
1 change: 1 addition & 0 deletions .evergreen/generate-tasks/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
target
Cargo.lock
4 changes: 1 addition & 3 deletions .evergreen/generate-tasks/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
static VERSIONS: &[&str] = &[
"4.0", "4.2", "4.4", "5.0", "6.0", "7.0", "8.0", "rapid", "latest",
];
static VERSIONS: &[&str] = &["4.2", "4.4", "5.0", "6.0", "7.0", "8.0", "rapid", "latest"];

static TOPOLOGIES: &[(&str, &str)] = &[
("standalone", "server"),
Expand Down
27 changes: 0 additions & 27 deletions .evergreen/suite-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@

tasks:

- name: test-4.0-standalone
tags: [4.0, standalone]
commands:
- func: "bootstrap mongo-orchestration"
vars:
MONGODB_VERSION: 4.0
TOPOLOGY: server
- func: "run driver test suite"

- name: test-4.2-standalone
tags: [4.2, standalone]
commands:
Expand Down Expand Up @@ -84,15 +75,6 @@ tasks:
TOPOLOGY: server
- func: "run driver test suite"

- name: test-4.0-replicaset
tags: [4.0, replicaset]
commands:
- func: "bootstrap mongo-orchestration"
vars:
MONGODB_VERSION: 4.0
TOPOLOGY: replica_set
- func: "run driver test suite"

- name: test-4.2-replicaset
tags: [4.2, replicaset]
commands:
Expand Down Expand Up @@ -165,15 +147,6 @@ tasks:
TOPOLOGY: replica_set
- func: "run driver test suite"

- name: test-4.0-sharded
tags: [4.0, sharded]
commands:
- func: "bootstrap mongo-orchestration"
vars:
MONGODB_VERSION: 4.0
TOPOLOGY: sharded_cluster
- func: "run driver test suite"

- name: test-4.2-sharded
tags: [4.2, sharded]
commands:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ For more details, including features, runnable examples, troubleshooting resourc
### Requirements

- Rust 1.83.0+ (See the [MSRV policy](#minimum-supported-rust-version-msrv-policy) for more information)
- MongoDB 4.0+
- MongoDB 4.2+

#### Supported Platforms

Expand Down
6 changes: 2 additions & 4 deletions src/action/find_and_modify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ impl<T: DeserializeOwned + Send + Sync> Collection<T> {

/// Atomically finds up to one document in the collection matching `filter` and updates it.
/// Both `Document` and `Vec<Document>` implement `Into<UpdateModifications>`, so either can be
/// passed in place of constructing the enum case. Note: pipeline updates are only supported
/// in MongoDB 4.2+.
/// passed in place of constructing the enum case.
///
/// This operation will retry once upon failure if the connection and encountered error support
/// retryability. See the documentation
Expand Down Expand Up @@ -133,8 +132,7 @@ impl<T: DeserializeOwned + Send + Sync> crate::sync::Collection<T> {

/// Atomically finds up to one document in the collection matching `filter` and updates it.
/// Both `Document` and `Vec<Document>` implement `Into<UpdateModifications>`, so either can be
/// passed in place of constructing the enum case. Note: pipeline updates are only supported
/// in MongoDB 4.2+.
/// passed in place of constructing the enum case.
///
/// This operation will retry once upon failure if the connection and encountered error support
/// retryability. See the documentation
Expand Down
3 changes: 0 additions & 3 deletions src/action/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ impl ClientSession {
/// [`crate::error::TRANSIENT_TRANSACTION_ERROR`] label. This label indicates that the entire
/// transaction can be retried with a reasonable expectation that it will succeed.
///
/// Transactions on replica sets are supported on MongoDB 4.0+. Transactions on sharded
/// clusters are supported on MongoDB 4.2+.
///
/// ```rust
/// # use mongodb::{bson::{doc, Document}, error::Result, Client, ClientSession};
/// #
Expand Down
12 changes: 4 additions & 8 deletions src/action/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ where
/// Updates all documents matching `query` in the collection.
///
/// Both `Document` and `Vec<Document>` implement `Into<UpdateModifications>`, so either can be
/// passed in place of constructing the enum case. Note: pipeline updates are only supported
/// in MongoDB 4.2+. See the official MongoDB
/// passed in place of constructing the enum case. See the official MongoDB
/// [documentation](https://www.mongodb.com/docs/manual/reference/command/update/#behavior) for more information on specifying updates.
///
/// `await` will return d[`Result<UpdateResult>`].
Expand All @@ -41,8 +40,7 @@ where
/// Updates up to one document matching `query` in the collection.
///
/// Both `Document` and `Vec<Document>` implement `Into<UpdateModifications>`, so either can be
/// passed in place of constructing the enum case. Note: pipeline updates are only supported
/// in MongoDB 4.2+. See the official MongoDB
/// passed in place of constructing the enum case. See the official MongoDB
/// [documentation](https://www.mongodb.com/docs/manual/reference/command/update/#behavior) for more information on specifying updates.
///
/// This operation will retry once upon failure if the connection and encountered error support
Expand Down Expand Up @@ -73,8 +71,7 @@ where
/// Updates all documents matching `query` in the collection.
///
/// Both `Document` and `Vec<Document>` implement `Into<UpdateModifications>`, so either can be
/// passed in place of constructing the enum case. Note: pipeline updates are only supported
/// in MongoDB 4.2+. See the official MongoDB
/// passed in place of constructing the enum case. See the official MongoDB
/// [documentation](https://www.mongodb.com/docs/manual/reference/command/update/#behavior) for more information on specifying updates.
///
/// [`run`](Update::run) will return d[`Result<UpdateResult>`].
Expand All @@ -87,8 +84,7 @@ where
/// Updates up to one document matching `query` in the collection.
///
/// Both `Document` and `Vec<Document>` implement `Into<UpdateModifications>`, so either can be
/// passed in place of constructing the enum case. Note: pipeline updates are only supported
/// in MongoDB 4.2+. See the official MongoDB
/// passed in place of constructing the enum case. See the official MongoDB
/// [documentation](https://www.mongodb.com/docs/manual/reference/command/update/#behavior) for more information on specifying updates.
///
/// This operation will retry once upon failure if the connection and encountered error support
Expand Down
6 changes: 2 additions & 4 deletions src/action/watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ use crate::{
impl Client {
/// Starts a new [`ChangeStream`] that receives events for all changes in the cluster. The
/// stream does not observe changes from system collections or the "config", "local" or
/// "admin" databases. Note that this method (`watch` on a cluster) is only supported in
/// MongoDB 4.0 or greater.
/// "admin" databases.
///
/// See the documentation [here](https://www.mongodb.com/docs/manual/changeStreams/) on change
/// streams.
Expand Down Expand Up @@ -121,8 +120,7 @@ where
impl crate::sync::Client {
/// Starts a new [`ChangeStream`] that receives events for all changes in the cluster. The
/// stream does not observe changes from system collections or the "config", "local" or
/// "admin" databases. Note that this method (`watch` on a cluster) is only supported in
/// MongoDB 4.0 or greater.
/// "admin" databases.
///
/// See the documentation [here](https://www.mongodb.com/docs/manual/changeStreams/) on change
/// streams.
Expand Down
2 changes: 0 additions & 2 deletions src/change_stream/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ pub struct ChangeStreamOptions {
/// the token. This will allow users to watch collections that have been dropped and
/// recreated or newly renamed collections without missing any notifications.
///
/// This feature is only available on MongoDB 4.2+.
///
/// See the documentation [here](https://www.mongodb.com/docs/master/changeStreams/#change-stream-start-after) for more
/// information.
pub start_after: Option<ResumeToken>,
Expand Down
3 changes: 1 addition & 2 deletions src/client/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ pub(crate) static SESSIONS_UNSUPPORTED_COMMANDS: Lazy<HashSet<&'static str>> = L
/// collections atomically. For more information about when and how to use transactions in MongoDB,
/// see the [manual](https://www.mongodb.com/docs/manual/core/transactions/).
///
/// Replica set transactions are supported on MongoDB 4.0+. Sharded transactions are supported on
/// MongoDDB 4.2+. Transactions are associated with a `ClientSession`. To begin a transaction, call
/// Transactions are associated with a `ClientSession`. To begin a transaction, call
/// [`ClientSession::start_transaction`] on a `ClientSession`. The `ClientSession` must be passed to
/// operations to be executed within the transaction.
///
Expand Down
6 changes: 3 additions & 3 deletions src/cmap/conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ pub struct ConnectionInfo {
/// A driver-generated identifier that uniquely identifies the connection.
pub id: u32,

/// A server-generated identifier that uniquely identifies the connection. Available on server
/// versions 4.2+. This may be used to correlate driver connections with server logs.
/// A server-generated identifier that uniquely identifies the connection. This may be used to
/// correlate driver connections with server logs.
pub server_id: Option<i64>,

/// The address that the connection is connected to.
Expand All @@ -64,7 +64,7 @@ pub(crate) struct Connection {
/// Driver-generated ID for the connection.
pub(crate) id: u32,

/// The server-side ID for this connection. Only set on server versions 4.2+.
/// The server-side ID for this connection.
pub(crate) server_id: Option<i64>,

/// The address of the server to which this connection connects.
Expand Down
28 changes: 0 additions & 28 deletions src/cmap/test/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ use crate::{
sdam::TopologyUpdater,
selection_criteria::ReadPreference,
test::{
block_connection_supported,
fail_command_supported,
get_client_options,
log_uncaptured,
topology_is_load_balanced,
Expand Down Expand Up @@ -86,13 +84,6 @@ async fn acquire_connection_and_send_command() {

#[tokio::test]
async fn concurrent_connections() {
if !block_connection_supported().await {
log_uncaptured(
"skipping concurrent_connections test due to server not supporting block connection",
);
return;
}

let mut options = get_client_options().await.clone();
if options.load_balanced.unwrap_or(false) {
log_uncaptured("skipping concurrent_connections test due to load-balanced topology");
Expand Down Expand Up @@ -166,22 +157,13 @@ async fn concurrent_connections() {
}

#[tokio::test(flavor = "multi_thread")]
#[function_name::named]

async fn connection_error_during_establishment() {
if topology_is_load_balanced().await {
log_uncaptured(
"skipping connection_error_during_establishment test due to load-balanced topology",
);
return;
}
if !fail_command_supported().await {
log_uncaptured(format!(
"skipping {} due to failCommand not being supported",
function_name!()
));
return;
}

let mut client_options = get_client_options().await.clone();
client_options.heartbeat_freq = Duration::from_secs(300).into(); // high so that monitors dont trip failpoint
Expand Down Expand Up @@ -227,17 +209,7 @@ async fn connection_error_during_establishment() {
}

#[tokio::test(flavor = "multi_thread")]
#[function_name::named]

async fn connection_error_during_operation() {
if !fail_command_supported().await {
log_uncaptured(format!(
"skipping {} due to failCommand not being supported",
function_name!()
));
return;
}

let mut options = get_client_options().await.clone();
let buffer = EventBuffer::<CmapEvent>::new();
options.cmap_event_handler = Some(buffer.handler());
Expand Down
5 changes: 2 additions & 3 deletions src/coll/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ pub enum UpdateModifications {
Document(Document),

/// An aggregation pipeline.
/// Only available in MongoDB 4.2+.
Pipeline(Vec<Document>),
}

Expand Down Expand Up @@ -223,7 +222,7 @@ pub struct UpdateOptions {

/// A document or string that specifies the index to use to support the query predicate.
///
/// Only available in MongoDB 4.2+. See the official MongoDB
/// See the official MongoDB
/// [documentation](https://www.mongodb.com/docs/manual/reference/command/update/#ex-update-command-hint) for examples.
pub hint: Option<Hint>,

Expand Down Expand Up @@ -290,7 +289,7 @@ pub struct ReplaceOptions {

/// A document or string that specifies the index to use to support the query predicate.
///
/// Only available in MongoDB 4.2+. See the official MongoDB
/// See the official MongoDB
/// [documentation](https://www.mongodb.com/docs/manual/reference/command/update/#ex-update-command-hint) for examples.
pub hint: Option<Hint>,

Expand Down
5 changes: 0 additions & 5 deletions src/concern/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,6 @@ async fn unacknowledged_write_concern_rejected() {
#[tokio::test]
#[function_name::named]
async fn snapshot_read_concern() {
// snapshot read concern was introduced in 4.0
if server_version_lt(4, 0).await {
return;
}

let client = Client::for_test().monitor_events().await;

let coll = client
Expand Down
15 changes: 7 additions & 8 deletions src/event/sdam.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ pub struct ServerHeartbeatStartedEvent {
/// The driver-generated ID for the connection used for the heartbeat.
pub driver_connection_id: u32,

/// The server-generated ID for the connection used for the heartbeat. This value is only
/// present on server versions 4.2+. If this event corresponds to the first heartbeat on a
/// new monitoring connection, this value will not be present.
/// The server-generated ID for the connection used for the heartbeat. If this event
/// corresponds to the first heartbeat on a new monitoring connection, this value will not
/// be present.
pub server_connection_id: Option<i64>,
}

Expand All @@ -151,8 +151,7 @@ pub struct ServerHeartbeatSucceededEvent {
/// The driver-generated ID for the connection used for the heartbeat.
pub driver_connection_id: u32,

/// The server-generated ID for the connection used for the heartbeat. This value is only
/// present for server versions 4.2+.
/// The server-generated ID for the connection used for the heartbeat.
pub server_connection_id: Option<i64>,
}

Expand All @@ -177,9 +176,9 @@ pub struct ServerHeartbeatFailedEvent {
/// The driver-generated ID for the connection used for the heartbeat.
pub driver_connection_id: u32,

/// The server-generated ID for the connection used for the heartbeat. This value is only
/// present on server versions 4.2+. If this event corresponds to the first heartbeat on a
/// new monitoring connection, this value will not be present.
/// The server-generated ID for the connection used for the heartbeat. If this event
/// corresponds to the first heartbeat on a new monitoring connection, this value will not
/// be present.
pub server_connection_id: Option<i64>,
}

Expand Down
1 change: 0 additions & 1 deletion src/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ pub(crate) use raw_output::RawOutput;
pub(crate) use search_index::{CreateSearchIndexes, DropSearchIndex, UpdateSearchIndex};
pub(crate) use update::{Update, UpdateOrReplace};

const SERVER_4_2_0_WIRE_VERSION: i32 = 8;
const SERVER_4_4_0_WIRE_VERSION: i32 = 9;
const SERVER_5_0_0_WIRE_VERSION: i32 = 13;
const SERVER_8_0_0_WIRE_VERSION: i32 = 25;
Expand Down
8 changes: 3 additions & 5 deletions src/operation/aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use super::{
ExecutionContext,
OperationWithDefaults,
WriteConcernOnlyBody,
SERVER_4_2_0_WIRE_VERSION,
SERVER_4_4_0_WIRE_VERSION,
};

Expand Down Expand Up @@ -115,10 +114,9 @@ impl OperationWithDefaults for Aggregate {
.and_then(|opts| opts.selection_criteria.as_ref())
}

fn supports_read_concern(&self, description: &StreamDescription) -> bool {
// for aggregates that write, read concern is only supported in MongoDB 4.2+.
!self.is_out_or_merge()
|| description.max_wire_version.unwrap_or(0) >= SERVER_4_2_0_WIRE_VERSION
fn supports_read_concern(&self, _description: &StreamDescription) -> bool {
// for aggregates that write, read concern is supported in MongoDB 4.2+.
true
}

fn write_concern(&self) -> Option<&WriteConcern> {
Expand Down
Loading