Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
eengoron opened this issue Feb 25, 2022 · 0 comments

Comments

@eengoron
Copy link

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.

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

No branches or pull requests

1 participant