Skip to content

Document._class_id is always overwritten #1132

@volfpeter

Description

@volfpeter

Describe the bug

Document._class_id is overwritten. Document initialization should check if it's set before assigning a value. This messes up the customization of document discriminators and leads to failing queries (update, find, link fetching...).

To Reproduce

Create a couple of documents (with inheritance pattern), set Settings.class_id for example to "type", add type: str = "my-doc-type-1", type: str = "my-doc-type-2", ... properties to documents and also set _class_id on each document to the same value as the type property.

Expected behavior

Update, find, link fetching queries work.

Additional context

I'll submit a PR with a fix that avoids overwriting _class_id if it's already set. It solves the issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions