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

@eengoron

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.

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