Skip to content

Error when working with multiple models #86

@mac-lgtm

Description

@mac-lgtm

When working with 2 different models, it seems like mongox is ignoring the collection name and inserting into the first one's collection.

Currently, I have 2 models defined in 2 different files:

class UserAction(mongox.Model, db=db, collection="user_actions"):
    server_id: int
    name: str
    aliases: list[str]
    emoji: str
    self_text: str
    receivers_text: list[str]
class ServerSetting(mongox.Model, db=db, collection="server_settings"):
    server_id: int
    ignored_channels: list[int]

Firstly, I insert into server_settings, but when I try to insert into user_actions, the object gets created inside the server_settings collection instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions