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

Dependabot/cargo/mongodb 3.0.1 #36

Conversation

davidbayo10
Copy link

No description provided.

@maxcountryman
Copy link
Owner

maxcountryman commented Jul 23, 2024

This should implement create and I believe that's not easily possible with stock mongo.

See: #16

@davidbayo10
Copy link
Author

Updating the MongoDB driver version should be separate from adapting to the new API of Tower Sessions. It shouldn't be coupled together, right?

@maxcountryman
Copy link
Owner

I disagree. There's no point in updating a broken implementation. If it can't be implemented then it should be abandoned altogether.

@davidbayo10
Copy link
Author

I understand your point, but I'd argue that Tower Sessions doesn't force you to implement the create method, it just recommends it.

async fn create(&self, session_record: &mut Record) -> Result<()> {
    default_create(self, session_record).await
}

async fn default_create<S: SessionStore + ?Sized>(
    store: &S,
    session_record: &mut Record,
) -> Result<()> {
    tracing::warn!(
        "The default implementation of `SessionStore::create` is being used, which relies on \
         `SessionStore::save`. To properly handle potential ID collisions, it is recommended that \
         stores implement their own version of `SessionStore::create`."
    );
    store.save(session_record).await?;
    Ok(())
}

To wrap up and as a possible idea, I think the only way to avoid possible ID collisions is to generate our unique ids. Using UUIDs or MongoDB Object IDs could be enough.

I hope a viable solution could be found.

@maxcountryman
Copy link
Owner

It only doesn't require it for compatibility reasons (and in the near future it will be required). But make no mistake: any implementation that doesn't provide create is broken.

Updates the requirements on [mongodb](https://github.com/mongodb/mongo-rust-driver) to permit the latest version.
- [Release notes](https://github.com/mongodb/mongo-rust-driver/releases)
- [Commits](mongodb/mongo-rust-driver@v2.7.0...v3.0.1)

---
updated-dependencies:
- dependency-name: mongodb
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot dependabot bot force-pushed the dependabot/cargo/mongodb-3.0.1 branch from 505fa45 to 69f2e38 Compare July 24, 2024 21:03
@dependabot dependabot bot deleted the dependabot/cargo/mongodb-3.0.1 branch September 2, 2024 00:27
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

Successfully merging this pull request may close these issues.

2 participants