8000 Implemented '$concatArrays' aggregation pipeline operator by lmoretto · Pull Request #672 · mongomock/mongomock · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Implemented '$concatArrays' aggregation pipeline operator #672

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

Merged
merged 3 commits into from
Oct 14, 2020

Conversation

lmoretto
Copy link
Contributor

This PR implements the $concatArrays aggregation pipeline operator.

8000
@codecov
Copy link
codecov bot commented Oct 12, 2020

Codecov Report

Merging #672 into develop will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #672      +/-   ##
===========================================
+ Coverage    95.43%   95.44%   +0.01%     
===========================================
  Files           19       19              
  Lines         3550     3558       +8     
===========================================
+ Hits          3388     3396       +8     
  Misses         162      162              
Impacted Files Coverage Δ
mongomock/aggregate.py 97.51% <100.00%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 706992a...d3f01b0. Read the comment docs.

@lmoretto
Copy link
Contributor Author

Hi @pcorpet,
I just saw that the codecov check fails.

However I think this is caused by the fact that, having now implemented $concatArrays, the following piece of code is no longer hit by existing test cases:

raise NotImplementedError(
"Although '%s' is a valid array operator for the "
'aggregation pipeline, it is currently not implemented '
'in Mongomock.' % operator)

Do you think I should change something?

Copy link
Member
@pcorpet pcorpet left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution. yes please make sure to switch the testing code to still cover the NotImplemented branch (with another array operator).

Also I have few other test cases that I'd like you to add.

@lmoretto
Copy link
Contributor Author

Hi @pcorpet, I applied the requested changes ;)

}
}
]
with self.assertRaises(OperationFailure):
Copy link
Member

Choose a reason for hiding this comment

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

Please use the self.cmp.compare_exceptions.aggregate(pipeline_parameter_not_array) function, same below. This ensures we use the same type of error in Pymongo and in mongomock without the need of the extra code.

@pcorpet
Copy link
Member
pcorpet commented Oct 14, 2020

Thanks a lot for the feature, I'm merging.

@pcorpet pcorpet merged commit 8909c05 into mongomock:develop Oct 14, 2020
Copy link
Contributor Author
lmoretto commented Oct 15, 2020

Great, thank you for merging this and for the great work you are doing with this project.

In the next few days i plan to also implement $map and $reduce aggregation operators.
Will a single PR for both operators be ok, or do you prefer two separate ones?

@lmoretto lmoretto deleted the feature/concatArrays branch October 15, 2020 06:34
@pcorpet
Copy link
Member
pcorpet commented Oct 15, 2020 via email

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.

2 participants
0