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

better support for objectIDs and arrays #199

Merged
merged 6 commits into from
Mar 31, 2024

Conversation

ReadWriteError
Copy link
Contributor

this fixes #187. It works by making changes to mongoose documents instead of plain objects then converting to a plain object at the end with toObject(). This way changes are more representative of what will really gets written to mongodb.

It's worth noting that now any subdocuments with _id in them will now have changes to that _id in the history. The catch is that the new _id in the history will be wrong as that _id is generated in the mongoose document which is discarded leaving mongodb to generate a new _id for the real change. I do have a solution to this problem in another branch... I'll get there.

I also added a test for arrays so that I didn't break support for them when messing with this code.

@ilovepixelart ilovepixelart added the enhancement New feature or request label Mar 31, 2024
@ilovepixelart ilovepixelart merged commit e1ed3c6 into ilovepixelart:main Mar 31, 2024
8 checks passed
@ilovepixelart
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

patches don't depopulate objects
2 participants