Implement the $split operator by khneal · Pull Request #661 · mongomock/mongomock
Conversation
I didn't see any issues mentioning support for $split, but I figured a PR is better than filing an issue.
@pcorpet - Note the potential conflict with #658 in Missing_Features.rst. I don't mind fixing this PR if it's easier to merge that one first.
Let me know if any of the .gitignore entries are a problem.
Thanks!
Side note - it was a bit strange to see all operators tested simultaneously in test__aggregate_string_operations(). Is there a reason for that, like making the tests run faster? If not, I would consider breaking those apart in a future PR.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the implementation.
Can you update test__mongomock also, to make sure the behavior stays the same between pymongo + MongoDb and mongomock?
Also, I believe you have no test where the split operation references a variable that does not exist:
{'$split': ['$missingField', 'l']}please add one.
|
|
||
| #### Python | ||
| *.py[co] | ||
| /venv |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please drop the changes to this .gitignore file, and use a local gitignore instead.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Good suggestion.
Can you update
test__mongomockalso, to make sure the behavior stays the same betweenpymongo+MongoDbandmongomock?
Done.
Also, I believe you have no test where the split operation references a variable that does not exist:
Added. I almost committed one like that initially, but didn't see other string operations testing the same. I'm glad you pointed that out since it changed the implementation so the KeyError is caught, which in turn fixed a consistency issue I had in test__mongomock. Nice. 😃
Thank you! The PR process for this project was quick and easy, and kudos to you for all your efforts making it so.
I look forward to the next release. If there's a pre-release build available somewhere/somehow, I would be interested in pulling that into my workflow.
khneal
deleted the
feature/aggregate_split
branch
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