better support for objectIDs and arrays #199
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.