Implemented '$concatArrays' aggregation pipeline operator by lmoretto · Pull Request #672 · mongomock/mongomock
This PR implements the $concatArrays aggregation pipeline operator.
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?
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.
Hi @pcorpet, I applied the requested changes ;)
| } | ||
| } | ||
| ] | ||
| with self.assertRaises(OperationFailure): |
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.
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?
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