Skip to content

feat(database): add find cursor iteration - #17

Merged
KilianBoute merged 1 commit into
mainfrom
feat/find-cursor-iteration
Aug 13, 2026
Merged

KilianBoute merged 1 commit into
mainfrom
feat/find-cursor-iteration

Conversation

@KilianBoute

@KilianBoute KilianBoute commented Aug 13, 2026 •

Copy link
Copy Markdown
Member

Description

This change adds cursor-style iteration support for database find operations through the new CursorResultInterface. Previously, consumers could only decode the entire result set at once with All(), which meant a single malformed document could fail the entire query result.

With per-document iteration (Next, Decode, and Close), callers can now handle decode failures on individual records while continuing to process valid documents. This improves resilience for workloads that operate on partially inconsistent or evolving data without sacrificing the rest of the result set.

The MongoDB implementation and mock database were both updated to support the new interface, ensuring consistent behavior between production code and tests. Additional test coverage verifies that:

  • iteration continues when a single document fails to decode
  • cursor errors are preserved and surfaced correctly
  • mock behavior matches real cursor semantics

Overall, this improves fault tolerance, makes data processing workflows more flexible, and enables more realistic testing of streaming query behavior.

Expose optional per-document iteration and decode support on find results so consumers can handle individual malformed documents without aborting the complete result set, with matching mock behavior and tests.
@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 18 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/database/mongodb.go 0.00% 14 Missing ⚠️
pkg/database/mock.go 81.81% 2 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@KilianBoute
KilianBoute merged commit 7c5f59b into main Aug 13, 2026
6 checks passed
@KilianBoute
KilianBoute deleted the feat/find-cursor-iteration branch August 13, 2026 13:53
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.

1 participant