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

RUST-1986 In 3.0.0, Collection::watch ignores the collection type parameter #1161

Closed
cvijdea-bd opened this issue Jul 2, 2024 · 4 comments
Closed
Assignees

Comments

@cvijdea-bd
Copy link

It seems that in 3.0.0 the .watch() method always returns a stream of ChangeStreamEvent<mongodb::bson::Document>? This seems unfortunate given that in 2.8.2 watch respected the T param of Collection.

Also, I don't see this change mentioned in the update notes.

let coll: Collection<bson::RawDocumentBuf> = ...;
let mut stream = coll.watch().await?;

// ERROR: cannot convert from `std::option::Option<ChangeStreamEvent<mongodb::bson::Document>>` to `std::option::Option<ChangeStreamEvent<RawDocumentBuf>>`
let doc: Option<bson::RawDocumentBuf> = stream.next().await.transpose()?;
@cvijdea-bd
Copy link
Author

Seems related to #1153

@cvijdea-bd
Copy link
Author

Oh I see now that there is also with_type on ChangeStream, so with this change it works as before:

let mut stream = coll.watch().await?.with_type::<ChangeStreamEvent<bson::RawDocumentBuf>>();

Then I guess this is the intended usage and this issue can be closed?

@abr-egn abr-egn removed the triage label Jul 3, 2024
@abr-egn abr-egn changed the title In 3.0.0, Collection::watch ignores the collection type parameter RUST-1986 In 3.0.0, Collection::watch ignores the collection type parameter Jul 3, 2024
@abr-egn
Copy link
Contributor

abr-egn commented Jul 3, 2024

This was an oversight and an unintended regression, we'll get a fix out shortly.

@abr-egn
Copy link
Contributor

abr-egn commented Jul 9, 2024

We've just released version 3.0.1 that includes the fix for this.

@abr-egn abr-egn closed this as completed Jul 9, 2024
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

2 participants