thedodd / wither

An ODM for MongoDB built on the official MongoDB Rust driver.
https://docs.rs/wither
Other
324 stars 40 forks source link

Wither not working with mongodb operating in async-std #96

Closed losintikfos closed 2 years ago

losintikfos commented 2 years ago

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 2 years ago

I have added wither Cargo definition.

losintikfos commented 2 years ago

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 2 years ago

FYI for anyone who comes across this issue in the future: