Mongodb(1.2.0) Crate : Compile Error when trying to use sync feature or async-std-runtime

I am trying to use. sync API in mongo 1.2.0.
Below is my cargo.toml file where I mention the mongo based on the document, it throws compile time error.

[dependencies]
bson = "1.2.0"
chrono = "0.4.6"
wither = "0.9.0-alpha.0"
wither_derive = "0.9.0-alpha.0"
serde = "1.0.85"
serde_derive = "1.0.85"
serde_json = "1.0.37"
tokio = { version = "0.3", features = ["full"] }
url = "1.7.2"
lazy_static = "1.2.0"
actix-web = { version = "0.7", features=["ssl"] }

[dependencies.mongodb]
version = "1.2.0"
default-features = false
features = ["sync"]

I am getting the following error

Compiling mongodb v1.2.0
error: tokio-runtime and sync can't both be enabled; either disable sync or set default-features = false in your Cargo.toml
--> /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/mongodb-1.2.0/src/lib.rs:164:1
|
164 | / compile_error!(
165 | | "tokio-runtime and sync can't both be enabled; either disable sync or set
166 | | default-features = false in your Cargo.toml"
167 | | );
| |__^
error: aborting due to previous error

Any help is appreciated,

The default set of enabled features in the wither crate is the wither/tokio-runtime feature, which in turn depends on the mongodb/tokio-runtime feature. You can only enable one of the mongodb/tokio-runtime, mongodb/sync and mongodb/async-std-runtime features at the time, but you enabled the first two, hence the error.

I don't think you can use wither in sync mode.

(This kind of exclusive feature flag is considered bad practice, and I think it is a mistake for mongodb to use this pattern.)

Also, please read this post and use proper formatting for your post:

It's not too bad in this post, but once you start posting code, it is completely unreadable to me if you don't use proper formatting.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.