From 91fb4549fe3ef9ecfe3f2f98b8e1a3887805a933 Mon Sep 17 00:00:00 2001 From: Allan Zhang <6740989+allan2@users.noreply.github.com> Date: Mon, 15 Dec 2025 10:31:11 -0500 Subject: [PATCH 1/2] fix: separate bson-3 from compat-3-3-0 This is a correction to split `bson-3` into its own feature. Upstream `compat-3-3-0` does not actually imply `bson-3`. https://docs.rs/crate/mongodb/3.4.1/features --- .github/workflows/ci.yml | 6 +++--- Cargo.toml | 3 ++- src/index.rs | 2 +- src/lib.rs | 2 +- src/repository.rs | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1b83eb6..8365a40 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,11 +55,11 @@ jobs: - name: Rust cache uses: Swatinem/rust-cache@v2.7.3 - - name: Lints (compat-3-0-0) + - name: Lints (bson 2) run: cargo clippy --workspace --no-default-features --features "compat-3-0-0 rustls" -v -- -Dwarnings - - name: Lints (compat-3-3-0) - run: cargo clippy --workspace --no-default-features --features "compat-3-3-0 rustls" -v -- -Dwarnings + - name: Lints (bson 3) + run: cargo clippy --workspace --no-default-features --features "bson-3 rustls" -v -- -Dwarnings - name: Tests run: cargo test --workspace -v diff --git a/Cargo.toml b/Cargo.toml index fb67f3a..3b2d787 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,8 @@ include = ["src/**/*", "README.md", "CHANGELOG.md"] [features] default = ["compat-3-0-0", "rustls"] compat-3-0-0 = ["mongodb/compat-3-0-0"] -compat-3-3-0 = ["mongodb/compat-3-3-0", "mongodb/bson-3"] +compat-3-3-0 = ["mongodb/compat-3-3-0"] +bson-3 = ["mongodb/bson-3"] openssl = ["mongodb/openssl-tls"] rustls = ["mongodb/rustls-tls"] diff --git a/src/index.rs b/src/index.rs index 602b842..4a3e6c5 100644 --- a/src/index.rs +++ b/src/index.rs @@ -2,7 +2,7 @@ use crate::CollectionConfig; -#[cfg(feature = "compat-3-3-0")] +#[cfg(feature = "bson-3")] use mongodb::bson::deserialize_from_bson; #[cfg(feature = "compat-3-0-0")] use mongodb::bson::from_bson as deserialize_from_bson; diff --git a/src/lib.rs b/src/lib.rs index 197ee72..6bab813 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -172,7 +172,7 @@ impl ToRepository for mongodb::Database { pub mod prelude { #[cfg(feature = "compat-3-0-0")] pub use mongodb::bson::de::Error as BsonDeserializeError; - #[cfg(feature = "compat-3-3-0")] + #[cfg(feature = "bson-3")] pub use mongodb::bson::error::Error as BsonError; pub use crate::mongo::bson::oid::ObjectId; diff --git a/src/repository.rs b/src/repository.rs index 0be0ad9..ed21606 100644 --- a/src/repository.rs +++ b/src/repository.rs @@ -5,7 +5,7 @@ use async_trait::async_trait; use mongodb::bson::oid::ObjectId; use mongodb::bson::{Document, doc}; -#[cfg(feature = "compat-3-3-0")] +#[cfg(feature = "bson-3")] use mongodb::bson::{deserialize_from_document, serialize_to_bson}; #[cfg(feature = "compat-3-0-0")] use mongodb::bson::{from_document as deserialize_from_document, to_bson as serialize_to_bson}; From f78ff91ddd9d367068e12ba649eff8dc7fae6172 Mon Sep 17 00:00:00 2001 From: Allan Zhang <6740989+allan2@users.noreply.github.com> Date: Mon, 15 Dec 2025 10:52:55 -0500 Subject: [PATCH 2/2] Bson 3 build fix --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8365a40..952d2a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,7 +59,7 @@ jobs: run: cargo clippy --workspace --no-default-features --features "compat-3-0-0 rustls" -v -- -Dwarnings - name: Lints (bson 3) - run: cargo clippy --workspace --no-default-features --features "bson-3 rustls" -v -- -Dwarnings + run: cargo clippy --workspace --no-default-features --features "compat-3-3-0 bson-3 rustls" -v -- -Dwarnings - name: Tests run: cargo test --workspace -v