Repository navigation
[2.4.x] Write $merge's keepExisting as the server spells it - #4594
Open
evanchooly wants to merge 1 commit into
Open
evanchooly wants to merge 1 commit into
evanchooly wants to merge 1 commit into
Conversation
MergeCodec lower-cased the driver's enum names, so WhenMatched.KEEP_EXISTING became "keep_existing", which the server rejects. Write the camel-case MQL value instead. # Conflicts: # core/src/test/java/dev/morphia/test/aggregation/stages/TestMerge.java
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Backport of #4591 to 2.4.x.
Problem:
MergeCodeclower-cased the driver's enum names, somerge(...).whenMatched(WhenMatched.KEEP_EXISTING)was sent aswhenMatched: "keep_existing". The server rejects that withBadValue: Enumeration value 'keep_existing' for field 'whenMatched' is not a valid value, so$mergewithkeepExistingcould not be used from Morphia at all. The single-word values (replace,merge,fail,insert,discard) were unaffected.Fix: the codec writes the camel-case MQL value (
keepExisting).Test:
TestMerge.keepExistingmerges two source documents into a target that already holds one of them, and checks that the existing document is kept and the other inserted. It fails with theBadValueerror above without the codec change and passes with it.Note: the cherry-pick conflicted only in the test, since 2.4.x still uses the TestNG
AggregationTeststyle; the test was rewritten in that style. 2.4.x has no Critter mapper, so the test ran under reflection only.Self-reviewed only.