Wither not working with mongodb operating in async-std
Closed this issue · 3 comments
losintikfos commented
I have mongodb
specified in Cargo as follows:
mongodb ={ version= "2.2.1", features = ["async-std"] }
wither = { git = "https://github.com/thedodd/wither", branch = "master" }
My model is specified with implementation as follows:
#[model(collection_name = "foo")]
pub struct Foo {
...
}
impl Foo {
pub(crate) async fn fetch(db: &Database, f: Option<Document>) -> Result<Self, ResError> {
if let Some(t) = Self::find_one(&db, f, None).await? {
return Ok(t);
}
Err(ResError::NotFound)
}
}
Unfortunately the call to find_one
does not seems to get executed. Any ideas what I might be doing wrong guys? thanks.
losintikfos commented
I have added wither Cargo definition.
losintikfos commented
I am going to close this issue as I believe it has nothing to do with wither due to trying to use native mongodb to perform the same classic task and yet the same problem.
patrickfreed commented
FYI for anyone who comes across this issue in the future:
- the feature flag needs to be specified as
async-std-runtime
, not justasync-std
- since
tokio-runtime
is a default flag, in order to use async-std, you also need to pass indefault-features = false