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

Handled dollar prefixed values for "createOrReplace" Mongo implementation #207

Merged
merged 2 commits into from
Sep 9, 2024

Conversation

suresh-prakash
Copy link
Contributor

No description provided.

Copy link

codecov bot commented Aug 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.70%. Comparing base (d5362f6) to head (ba4898b).
Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #207      +/-   ##
============================================
+ Coverage     79.60%   79.70%   +0.09%     
- Complexity     1021     1022       +1     
============================================
  Files           194      194              
  Lines          4865     4879      +14     
  Branches        404      408       +4     
============================================
+ Hits           3873     3889      +16     
+ Misses          707      706       -1     
+ Partials        285      284       -1     
Flag Coverage Δ
integration 79.70% <100.00%> (+0.09%) ⬆️
unit 57.30% <50.00%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link

github-actions bot commented Aug 29, 2024

Test Results

 38 files  ±0   38 suites  ±0   32s ⏱️ +2s
235 tests ±0  235 ✅ ±0  0 💤 ±0  0 ❌ ±0 
488 runs  ±0  488 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit ba4898b. ± Comparison against base commit d5362f6.

♻️ This comment has been updated with latest results.

@@ -113,6 +124,17 @@ public static JsonNode recursiveClone(
if (value.isObject()) {
newValue = recursiveClone(value, function, emptyObjectConverter);
}
if (value.isArray()) {
Copy link
Contributor

@aaron-steinfeld aaron-steinfeld Aug 29, 2024

Choose a reason for hiding this comment

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

Typically in this kind of function you'd have object/array/primitives as sibling code paths, with recursion inside object and array. Here it looks like we handle primitives, else assume it's an object and only treat array differently inside the processing of object fields? Am I reading that right and if so, is there a reason to do it that way?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are treating "primitive values" differently.
Also, we are treating "object keys" differently.
Both needs encoding so that a $ prefix is (treated literally and) not treated as the special field lookup operator.

We are still doing similar thing. Nested inside objects and arrays and handling primitives differently. Because, we also want object keys to be encoded, this method turned out this way.

In this PR, I'm just handling the missing case of "primitive values" (especially when they are strings). So, just piggy bagging onto the existing method.

}
}
if (newValue.isTextual()) {
newValue = new TextNode(function.apply(newValue.asText()));
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this, we have already applied transformation to each value?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry my mistake. I read it as array node.

}
}
if (newValue.isTextual()) {
newValue = new TextNode(function.apply(newValue.asText()));
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry my mistake. I read it as array node.

@suresh-prakash suresh-prakash merged commit 9aa8fe6 into main Sep 9, 2024
7 checks passed
@suresh-prakash suresh-prakash deleted the handle_doller_prefix_values branch September 9, 2024 09:48
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.

3 participants