Skip to content
This repository was archived by the owner on Dec 1, 2025. It is now read-only.
This repository was archived by the owner on Dec 1, 2025. It is now read-only.

in_bulk queries do not include a _cls attribute, so objects that inherit from the same base class can unexpectedly be returned #34

Description

@eengoron

Right now, when using the in_bulk method, a _cls is not included in the query.

So, if you have documents like:

class Parent(Document):
    ...

class ChildOne(Parent):
    ...

class ChildTwo(Parent):
    ...

And then you try to do:

ChildTwo.objects.in_bulk(["PK of a ChildOne object"])

a ChildOne object will be returned even though you're using the ChildTwo document. This happens because a _cls is not included in the in_bulk query, so it just looks through the entire collection.

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions