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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

assign() on JSON property fails when persisting with MongoDB driver #5158

Closed
5 tasks done
alexandre-abrioux opened this issue Jan 19, 2024 · 1 comment
Closed
5 tasks done

Comments

@alexandre-abrioux
Copy link

alexandre-abrioux commented Jan 19, 2024

Describe the bug

Hi! First of all, thank you for maintaining the best ORM/ODM for NodeJS 馃檪

While migrating a project from v5 to v6, I noticed some inconsistencies with persisting JSON properties.

Using bisection, I've identified that version 5.6.10 introduced a regression/bug. I'm not sure which commit precisely, but you can find the list here.

The issue is the following: When updating a JSON property using assign(), the change is not persisted in the database.

While digging a bit more, I discovered that the __originalEntityData wrapper property is also updated with assign(), thus preventing the changeset from being computed at commit time.

More info:

  • When updating the property with a brand new object, it works. The issue is only present with assign().
  • I confirmed the issue with the MongoDB driver but not with the SQLite driver, it seems to work fine with SQLite.

Reproduction

Here is a test case to reproduce the issue: https://github.com/alexandre-abrioux/mikro-orm-issue-5158

What driver are you using?

@mikro-orm/mongodb

MikroORM version

6.0.5

Node.js version

18.18.0

Operating system

No response

Validations

@B4nan B4nan closed this as completed in a360300 Jan 24, 2024
@alexandre-abrioux
Copy link
Author

Thank you @B4nan 馃檪

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