Skip to content

Make Cursor.alive respect limit and skip - #959

Open
DanShinde wants to merge 1 commit into
mongomock:developfrom
DanShinde:fix/cursor-alive-limit
Open

DanShinde wants to merge 1 commit into
mongomock:developfrom
DanShinde:fix/cursor-alive-limit

Conversation

@DanShinde

Copy link
Copy Markdown

Cursor.alive compared the number of emitted documents against the full result set, ignoring limit() and skip(), so a cursor that had returned every document it would ever return still reported alive=True. It now compares against the limited and skipped results, which matches MongoDB.

Fixes #901

Cursor.alive compared the number of emitted documents against the full
result set, ignoring limit() and skip(), so a cursor that had returned
every document it would ever return still reported alive=True. It now
compares against the limited and skipped results, which matches
MongoDB.

Fixes mongomock#901
@DanShinde

Copy link
Copy Markdown
Author

Note on the failing checks: both failures come from develop, not from this change.

  • test (3.9): Hatch now installs coverage>=7.11, which requires Python 3.10+, so the 3.9 job fails while installing dependencies. The other test jobs are then cancelled by fail-fast. Fix CI against current test dependencies #951 pins the test dependencies and fixes this.
  • Build & verify package: the current hatchling writes Metadata-Version: 2.5, and the older twine bundled in hynek/build-and-inspect-python-package@v2 rejects it. A clean build of develop produces the same 2.5 metadata (it passes twine check with twine 7), so bumping that action or pinning hatchling should fix it.

Locally, hatch fmt --check passes, and so does hatch test on Python 3.10–3.13 with pymongo 3, pymongo 4 and no pymongo.

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.

Cursor.alive() does not mimic MongoDB behavior

1 participant