Skip to content

SODA: streaming getCursor() for unbounded result sets (#213)#215

Merged
lemenkov merged 1 commit into
masterfrom
soda-getcursor-213
Jun 25, 2026
Merged

SODA: streaming getCursor() for unbounded result sets (#213)#215
lemenkov merged 1 commit into
masterfrom
soda-getcursor-213

Conversation

@lemenkov

Copy link
Copy Markdown
Owner

SODA follow-up: stream large result sets without the getDocuments materialisation cap.

API (sync + async)

  • SodaOperation.getCursor(batchSize=100) → an iterator of SodaDocument, fetched in batches via offset pagination (repeated skip/limit windows over the same find()). Honours an explicit skip/limit, stops on the first short batch.
for doc in coll.find().filter(qbe).getCursor(batchSize=500): ...
async for doc in coll.find().getCursor(): ...

getDocuments() and getCursor() now share one batch-fetch helper.

Tests: documents stream exactly once with no duplicate or skip across batches; filter and limit are honoured; empty result yields nothing. Sync + async; 23ai/21c pass, 11g/9i skip. Offline 527.

Closes #213

🤖 Generated with Claude Code

getDocuments() materialises matches into host arrays, so it needs a
capacity and raises past a cap. Add SodaOperation.getCursor(batchSize=100),
which streams the matched documents via offset pagination — repeated
skip/limit windows over the same find() — so an arbitrarily large result
set fetches without choosing a cap. Honours an explicit skip / limit and
stops on the first short batch.

Returns an iterator (sync) / async iterator (async):
  for doc in coll.find().filter(qbe).getCursor(batchSize=500): ...
  async for doc in coll.find().getCursor(): ...

getDocuments() and getCursor() now share one batch-fetch helper. Verified
documents stream exactly once with no duplicate or skip across batches,
and that filter / limit are honoured. Sync + async; 23ai/21c pass,
11g/9i skip.

Closes #213

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
@lemenkov lemenkov added this to the 1.10.1 milestone Jun 25, 2026
@lemenkov lemenkov merged commit de53004 into master Jun 25, 2026
10 checks passed
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.

SODA: streaming getCursor() for unbounded result sets

1 participant