Fix unscoped when using postgres and raw queries #5
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.
Should fix #4.
This change should be non-controversial:
_.isMatch(object, source)
is equivalent to_.matches(source)(object)
, but_.isMatch
doesn't deep clone the source.I've updated a test to "cover" this (in the hopes that perhaps eventually it'll be valuable), but unfortunately we'd need unit tests against postgres, too, instead of just sqlite, to confirm that this issue isn't occurring. Note that the test wouldn't fail if the issue exists, it would simply log an error and succeed anyways. (In the project I'm working on, this issue only seems to cause tests to fail when many concurrent connections are already open, and with many tests being run. I don't know what the exact problem is, but I'm not sure it's worth it to spend a bunch of time trying to design a more effective test; this should at least log an error when it's occurring)
That said, I've manually tested against another project which does use postgres, and it seems the issue has disappeared with this change (and generally that unscoping works as before).