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

DOCSP-39705: Cursors #72

Merged
merged 6 commits into from
Aug 29, 2024
Merged

DOCSP-39705: Cursors #72

merged 6 commits into from
Aug 29, 2024

Conversation

mcmorisi
Copy link
Collaborator

Mostly adapted from Pymongo Cursors. Consulted with @rozza and cut out a few sections that don't make sense to include for the RS driver.

Pull Request Info

PR Reviewing Guidelines

JIRA - https://jira.mongodb.org/browse/DOCSP-39705
Staging - https://preview-mongodbmcmorisi.gatsbyjs.io/java-rs/DOCSP-39705-cursors/read/cursors/

Self-Review Checklist

  • Is this free of any warnings or errors in the RST?
  • Did you run a spell-check?
  • Did you run a grammar-check?
  • Are all the links working?
  • Are the facets and meta keywords accurate?

Copy link
Collaborator

@norareidy norareidy left a comment

Choose a reason for hiding this comment

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

LGTM with a few small things

source/read/cursors.txt Outdated Show resolved Hide resolved
source/read/cursors.txt Outdated Show resolved Hide resolved
source/read/cursors.txt Outdated Show resolved Hide resolved
source/read/cursors.txt Outdated Show resolved Hide resolved
@mcmorisi mcmorisi requested review from a team and jyemin and removed request for a team August 27, 2024 17:39
@jyemin jyemin requested a review from rozza August 28, 2024 13:01
Copy link

@jyemin jyemin left a comment

Choose a reason for hiding this comment

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

LGTM, but added @rozza for a quick look.

Copy link
Member

@rozza rozza left a comment

Choose a reason for hiding this comment

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

Cursors as a concept aren't massively relevant to Reactive Streams. They are an implementation detail of the underlying driver and reactive streams has their own language and ways to deal with memory usage (via Subscription requests for data).

So this makes this page not quite the same as a synchronous driver. That said the example of tailable cursors is good and should be explained.

I think the best course of action is to describe that read publishers are backed by cursors from the server. Managing the data requested from these underlying custsos is done automatically via Subscription.request. Note FindPublisher.batchSize can be used to set the size of the batch of data each underlying cursor contains.

source/read/cursors.txt Show resolved Hide resolved

If the number and size of documents returned by your query exceeds available
application memory, your program will crash. If you expect a large result
set, :ref:`access your cursor iteratively <kotlin-sync-cursors-iterate>`.
Copy link
Member

Choose a reason for hiding this comment

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

nit: links to kotli-sync-cursors-iterate

Copy link

netlify bot commented Aug 29, 2024

Deploy Preview for docs-java-rs ready!

Name Link
🔨 Latest commit d86690a
🔍 Latest deploy log https://app.netlify.com/sites/docs-java-rs/deploys/66d09d4a8132bc00081d9e81
😎 Deploy Preview https://deploy-preview-72--docs-java-rs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@mcmorisi mcmorisi requested a review from rozza August 29, 2024 13:20
Copy link
Member

@rozza rozza left a comment

Choose a reason for hiding this comment

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

One last nit - then LGTM

batches. Because a cursor holds only a subset of documents at any given time,
cursors reduce both memory consumption and network bandwidth usage.

Whenever the {+driver-short+} performs a read operation that returns multiple
Copy link
Member

Choose a reason for hiding this comment

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

I think this paragraph is now redundant.

Comment on lines 30 to 31
Whenever the {+driver-short+} performs a read operation that returns multiple
documents, it automatically returns those documents in a cursor.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Whenever the {+driver-short+} performs a read operation that returns multiple
documents, it automatically returns those documents in a cursor.

@mcmorisi mcmorisi requested a review from rozza August 29, 2024 16:05
Copy link
Member

@rozza rozza left a comment

Choose a reason for hiding this comment

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

LGTM!

@mcmorisi mcmorisi merged commit 6ce34dc into mongodb:main Aug 29, 2024
1 check passed
@mcmorisi mcmorisi deleted the DOCSP-39705-cursors branch August 29, 2024 16:09
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.

4 participants