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

[BUG]before_event bug #902

Open
CAPITAINMARVEL opened this issue Mar 25, 2024 · 3 comments
Open

[BUG]before_event bug #902

CAPITAINMARVEL opened this issue Mar 25, 2024 · 3 comments
Labels

Comments

@CAPITAINMARVEL
Copy link

class Sample(Document):
num: int
name: str
version: int = 0

@before_event(Update)
def increase_version(self):
    self.version += 1

doc = await Sample.find_one()
await doc.inc({Sample.num: 1})

i looked in database num increase so its clearly updated
but the versioning is never changing

@CAPITAINMARVEL
Copy link
Author

its because in update it only update with args from the query itself but the action event doesnt it it

@roman-right
Copy link
Member

Hi @CAPITAINMARVEL ,
Unfortunately it would be tricky and not explicit enough to add an addition set step to the update query for this case

Copy link

This issue is stale because it has been open 30 days with no activity.

@github-actions github-actions bot added the Stale label May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants