Skip to content

Cursor.alive() does not mimic MongoDB behavior #901

Open

Description

@bolmstedt

Setting a limit on a cursor and retrieving items until the limit is reached will result in .alive() to return False, however not with the mongomock implementation, as it checks the number of documents without limit and skip:

@property
def alive(self):
return self._emitted != len(self._compute_results(with_limit_and_skip=False))

It should probably do something like this instead:

return self._emitted != len(self._compute_results(with_limit_and_skip=True)) 

Activity

  1. added a commit that references this issue on Nov 22, 2026
    a6eaf4d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions