Skip to content

Build error with "compat-3-3-0" and "bson-3" #1543

@AzHicham

Description

@AzHicham

Versions/Environment

  1. What version of Rust are you using?
    Rust stable 1.90.0 1159e78c4 2025-09-14

  2. What operating system are you using?
    Ubuntu 25.10

  3. What versions of the driver and its dependencies are you using? (Run cargo pkgid mongodb & cargo pkgid bson)
    registry+https://github.com/rust-lang/crates.io-index#[email protected]
    registry+https://github.com/rust-lang/crates.io-index#[email protected]

  4. What version of MongoDB are you using? (Check with the MongoDB shell using db.version())
    MongoDB 8.2.1 Community

  5. What is your MongoDB topology (standalone, replica set, sharded cluster, serverless)?
    standalone

Describe the bug

I tried to switch from feature flag "compat-3-0-0" to "compat-3-3-0" but i'm getting compile error from mongo rust driver.

[Cargo.toml]

[dependencies.mongodb]
version = "3"
default-features = false
features = ["rustls-tls", "dns-resolver", "aws-auth", "bson-3", "compat-3-3-0"]
optional = true

Two build error:

error[E0277]: the trait bound `bson::Bson: From<[&str; N]>` is not satisfied
   --> /home/hazimani/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/mongodb-3.4.1/src/atlas_search.rs:333:40
    |
333 | impl<const N: usize> StringOrArray for [&str; N] {}
    |                                        ^^^^^^^^^ the trait `From<[&str; N]>` is not implemented for `bson::Bson`

error[E0277]: the trait bound `bson::Bson: From<[bson::Document; N]>` is not satisfied
   --> /home/hazimani/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/mongodb-3.4.1/src/atlas_search.rs:474:42
    |
474 | impl<const N: usize> DocumentOrArray for [Document; N] {}
    |                                          ^^^^^^^^^^^^^ the trait `From<[bson::Document; N]>` is not implemented for `bson::Bson`

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions