Skip to content
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

Using basic example #81

Open
somehowchris opened this issue Apr 11, 2021 · 11 comments
Open

Using basic example #81

somehowchris opened this issue Apr 11, 2021 · 11 comments

Comments

@somehowchris
Copy link

somehowchris commented Apr 11, 2021

Hey man,

I love the effort and the crate, but I seem to have a bit of trouble getting the basic things running.

I started using it with rocket the web framework since it will support tokio with 0.5.0, but the find method seems to run into a few compile issues.

error[E0599]: no method named `next` found for struct `ModelCursor<UserEntity>` in the current scope
  --> src/users/service.rs:20:25
   |
20 |   print!("{:?}", cursor.next().await);
   |                         ^^^^ method not found in `ModelCursor<UserEntity>`

To my knowledge, this is basically the same as your basic example, but it should just output the first one (if there is any).

This is the code I call before.

let mut cursor: ModelCursor<UserEntity> = UserEntity::find(db_connection, None, None).await.unwrap();

I have defined the model as followed

#[derive(Debug, Model, Serialize, Deserialize)]
#[serde(rename_all(serialize = "camelCase", deserialize = "snake_case"))]
#[model(index(keys=r#"doc!{"name": 1}"#, options=r#"doc!{"unique": true}"#))]
pub struct UserEntity {
  #[serde(rename="_id", skip_serializing_if="Option::is_none")]
  pub id: Option<ObjectId>,
  pub name: String
}

Am I missing something out? I have also tried to run your exact example, but that neither worked

@dariusc93
Copy link

I assume you figured it out but if not you would need futures::StreamExt.

@thedodd
Copy link
Owner

thedodd commented May 31, 2021

Hey, thanks for the follow-up! I apologize about the complete lack of response. And yes, that is correct. The basic example in the readme is compiled and tested. Maybe you forgot to include the StreamExt trait during copy/paste?

@somehowchris
Copy link
Author

@thedodd Any chance of updating Tokio? Would be nice since rocket can handle Async things now

@thedodd
Copy link
Owner

thedodd commented Aug 18, 2021

@somehowchris hey, that's a good idea. Will do.

@somehowchris
Copy link
Author

somehowchris commented Aug 18, 2021

@thedodd ever considered (or will you consider) to get synk, depenadabot or renovate? To get dependency updates and for security reasons

@thedodd
Copy link
Owner

thedodd commented Aug 18, 2021

Definitely, though in this case it wouldn't make any difference. The only reason I haven't already done so is due to time constraints, not because I was unaware of the Tokio updates and such :).

Wither was one of my first open source Rust projects ... and I personally do not use it much any more, only because I don't use MongoDB much anymore. So I definitely rely upon the community for update requests and the like.

I would love to have someone else actively using the project to join as a co-maintainer, which would be a boon to everyone involved.

@thedodd
Copy link
Owner

thedodd commented Aug 18, 2021

@somehowchris as it turns out, we are blocked on upgrading to Tokio 1.0 until the underlying MongoDB crate updates. Wither is just a lightweight dependency on top of the mongodb crate, so we do not actually specify any runtime deps in this crate.

@patrickfreed
Copy link

Note that mongodb has support for tokio 1.0 starting in 2.0.0-alpha (which is basically just the 1.x driver with tokio 1.0 support). Later 2.0 pre-releases (2.0.0-beta.3 being the most recent) also support tokio 1.0 along with a lot of new features and breaking changes. So if you're okay with depending on a pre-release, you don't need to wait any longer. For what it's worth, 2.0.0-beta.3 will be very similar to the actual 2.0.0 release and there shouldn't be any major breaking changes between the two of them.

@simoneromano96
Copy link
Collaborator

Definitely, though in this case it wouldn't make any difference. The only reason I haven't already done so is due to time constraints, not because I was unaware of the Tokio updates and such :).

Wither was one of my first open source Rust projects ... and I personally do not use it much any more, only because I don't use MongoDB much anymore. So I definitely rely upon the community for update requests and the like.

I would love to have someone else actively using the project to join as a co-maintainer, which would be a boon to everyone involved.

Hi, could you consider me as a co-mantainer? I work fulltime but in my spare time I'd like to keep this project alive, I believe it is one of the best Rust database projects!

@thedodd
Copy link
Owner

thedodd commented Sep 2, 2021

@simoneromano96 I definitely need to get some other folks involved in keeping this project alive. I'll send you an invite!

@simoneromano96
Copy link
Collaborator

@thedodd Any chance of updating Tokio? Would be nice since rocket can handle Async things now

Hi, I would create a feature in wither to use the mongo client beta, WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants