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

Allow iterating through a change stream #339

Merged
merged 1 commit into from
Apr 7, 2024
Merged

Conversation

Joannis
Copy link
Member

@Joannis Joannis commented Apr 7, 2024

Currently, ChangeStreams require the .forEach method for iteration. This PR makes iterating possible through for try await change in changeStream syntax.

This PR also adds a cancellationHandler in Cursor.getMore because change streams could be kept open potentially indefinitely while waiting for more data. This can prolong the lifetime of a change stream well beyond expected.

@Joannis Joannis requested review from Obbut and Andrewangeta April 7, 2024 18:54
Copy link
Collaborator

@Andrewangeta Andrewangeta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks straight forward.

@Joannis Joannis merged commit 929e88f into main Apr 7, 2024
@Joannis Joannis deleted the jo/iterate-change-stream branch April 7, 2024 19:00
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