-
Notifications
You must be signed in to change notification settings - Fork 178
RUST-2217 Optionally support bson crate 3.0 #1380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0384a7e
fbd3f32
c54ca20
99cdede
c1e0af0
1fe64fb
4358d38
ecd77ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ license = "Apache-2.0" | |
readme = "README.md" | ||
name = "mongodb" | ||
version = "3.2.3" | ||
rust-version = "1.74" | ||
rust-version = "1.81" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needed to change because bson's msrv at head is 1.81; when doing an msrv compile against 2.x it would work because the crates.io published version had an msrv of 1.48, but there's no published version for 3.x so it needs to use the one from git. |
||
|
||
exclude = [ | ||
"etc/**", | ||
|
@@ -30,7 +30,10 @@ exclude = [ | |
|
||
[features] | ||
default = ["compat-3-0-0", "rustls-tls", "dns-resolver"] | ||
compat-3-0-0 = [] | ||
compat-3-0-0 = ["compat-3-3-0", "bson-2"] | ||
compat-3-3-0 = [] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keeping a rolling There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice. That seems like a good precaution in case there is a future need to make a required feature optional. |
||
bson-2 = ["dep:bson2", "mongocrypt/bson-2"] | ||
bson-3 = ["dep:bson3", "mongocrypt/bson-3"] | ||
sync = [] | ||
rustls-tls = ["dep:rustls", "dep:tokio-rustls"] | ||
openssl-tls = ["dep:openssl", "dep:openssl-probe", "dep:tokio-openssl"] | ||
|
@@ -73,7 +76,6 @@ tracing-unstable = ["dep:tracing", "dep:log"] | |
async-trait = "0.1.42" | ||
base64 = "0.13.0" | ||
bitflags = "1.1.0" | ||
bson = { git = "https://github.com/mongodb/bson-rust", branch = "main", version = "2.14.0" } | ||
chrono = { version = "0.4.7", default-features = false, features = [ | ||
"clock", | ||
"std", | ||
|
@@ -92,7 +94,6 @@ hmac = "0.12.1" | |
once_cell = "1.19.0" | ||
log = { version = "0.4.17", optional = true } | ||
md-5 = "0.10.1" | ||
mongocrypt = { git = "https://github.com/mongodb/libmongocrypt-rust.git", branch = "main", optional = true, version = "0.2.1" } | ||
mongodb-internal-macros = { path = "macros", version = "3.2.3" } | ||
num_cpus = { version = "1.13.1", optional = true } | ||
openssl = { version = "0.10.38", optional = true } | ||
|
@@ -120,6 +121,27 @@ zstd = { version = "0.11.2", optional = true } | |
macro_magic = "0.5.1" | ||
rustversion = "1.0.20" | ||
|
||
[dependencies.bson2] | ||
git = "https://github.com/mongodb/bson-rust" | ||
branch = "2.15.x" | ||
package = "bson" | ||
version = "2.15.0" | ||
optional = true | ||
|
||
[dependencies.bson3] | ||
git = "https://github.com/mongodb/bson-rust" | ||
branch = "main" | ||
package = "bson" | ||
version = "3.0.0" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mostly out of curiosity: will this break if we try to release the driver before bson 3.0 is released? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
optional = true | ||
|
||
[dependencies.mongocrypt] | ||
git = "https://github.com/mongodb/libmongocrypt-rust.git" | ||
branch = "main" | ||
version = "0.3.0" | ||
default-features = false | ||
optional = true | ||
|
||
[dependencies.pbkdf2] | ||
version = "0.11.0" | ||
default-features = false | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
msrv = "1.74.0" | ||
msrv = "1.81.0" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
use bson::{Bson, Document}; | ||
use crate::bson::{Bson, Document}; | ||
use std::time::Duration; | ||
|
||
use crate::{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
use bson::{Bson, Document}; | ||
use crate::bson::{Bson, Document}; | ||
use std::time::Duration; | ||
|
||
use crate::{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
use std::time::Duration; | ||
|
||
use bson::Bson; | ||
use crate::bson::Bson; | ||
|
||
use crate::{ | ||
coll::options::DropIndexOptions, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
use bson::{doc, Bson}; | ||
use crate::bson::{doc, Bson}; | ||
|
||
use crate::{ | ||
action::action_impl, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I accidentally broke these by changing the formatting of
Cargo.toml
to no longer match, but AFAICT the MSRV resolver is working fine with the git dependencies now.I'm not sure if this would have been a viable solution as we progress with bson 3.0 since there's no published version yet to fall back on, so hopefully I'm not missing a failure mode here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@isabelatkinson I'd like your input here - I can't find any brokenness but I'm deeply wary of things that work when I don't expect them to :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This originally had to be fixed when the driver's MSRV (1.74) was less than bson's (1.81) - the MSRV resolver couldn't look back for an older MSRV-compatible version with a git dependency instead of a published version dependency. That problem goes away with the driver's MSRV being >= bson's MSRV (which is done in this PR) since an older version doesn't need to be selected, but it will come up again if we bump bson without bumping the driver. I think we can just figure that out if/when it comes up again, though - we should be able to do something similar once 3.0 is actually published.