Skip to content

Conversation

026Fatih
Copy link

collection.objects can be a partial function. When it is, trying to call in_bulk on it was causing error.

Note: I added explicit type check before calling it, but I can change it to be always called (because query set is callable).

@bagerard
Copy link
Collaborator

bagerard commented Sep 2, 2025

Hi, could you clarify in which case collection.objects is a partial and provide a test case ?

@026Fatih
Copy link
Author

026Fatih commented Sep 3, 2025

Hello,
This issue occurs when the custom queryset manager function takes more than two parameters. In that case, it gets wrapped in a partial, as shown in the snippet from mongoengine/queryset/manager.py:

else:
    queryset = partial(self.get_queryset, owner, queryset)

I'll be adding a test case shortly.

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.

2 participants