Skip to content

Conversation

alexandre-abrioux
Copy link
Contributor

@alexandre-abrioux alexandre-abrioux commented Sep 30, 2024

This PR fixes a regression introduced in v6.3.11.

After upgrading from v6.3.10 to v6.3.11, ObjectID subproperties of JSON properties are not persisted in the MongoDB database.

The fix reverts the change in 55df57f that uses structuredClone instead of Utils.clone() to convert JSON to database values in the MongoDB driver. Unfortunately, structuredClone doesn't clone non-built-in classes (see supported types).

I've added a condition to Utils.clone to continue supporting both tests:

Related issues:

@alexandre-abrioux alexandre-abrioux changed the title fix(mongodb): should persist ObjectID in JSON fix(mongodb): should persist ObjectID in JSON properties Sep 30, 2024
Copy link

codecov bot commented Sep 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.78%. Comparing base (f48e544) to head (faf77da).

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #6091    +/-   ##
========================================
  Coverage   99.78%   99.78%            
========================================
  Files         264      264            
  Lines       18755    18755            
  Branches     4090     4415   +325     
========================================
  Hits        18715    18715            
  Misses         40       40            

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@B4nan B4nan changed the title fix(mongodb): should persist ObjectID in JSON properties fix(mongo): fix persisting objects like ObjectID in JSON properties Sep 30, 2024
Copy link
Member

@B4nan B4nan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@B4nan B4nan merged commit c28f06f into mikro-orm:master Sep 30, 2024
12 checks passed
@alexandre-abrioux alexandre-abrioux deleted the json-objectid branch September 30, 2024 18:09
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

Successfully merging this pull request may close these issues.

2 participants