-
Notifications
You must be signed in to change notification settings - Fork 104
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
Fix aggregate with Mongo 3.6 #224
Conversation
Also, I did a little PEP8 cleanup on the module, but put that in a separate commit so it would be clear what changes were actual changes and what changes were just cleanup. |
I spoke too soon, it looks like this is going to have to be a little more complicated. |
Just a heads up, for in the future, no PEP8 cleanups in bug-fixes and features, that makes a mess of things when reviewing. If you would like do a PEP8 clean, awesome! Please do! But make sure that that is the only thing that is done in a PR. :) Does that make sense? |
That makes perfect sense. I should have thought about that 😞 |
- Handle the aggregate cursor inline, keeping with the original API - Orginal return value shape has been maintiained
This reverts commit 217c472.
1 similar comment
...setup errors in Travis... 😩 Also, wow tests take a long time to run |
Re-triggering the 3 failed builds as they were network issues. @IlyaSkriblovsky what do think of this PR? :) |
@trenton42 can you write a test that could trigger this code path please? :) |
Thanks for your finding and fix!
Yes, I think this is reasonable. May be to have
|
@IlyaSkriblovsky Thank you for the feedback!
As I was looking through this code, I noticed that |
It seems to me that
There are many places in txmongo which still use old-style binary requests. I'm not sure we are using new command-style getMore requests anywhere... |
- Added `initial_batch_size` keyword argument - Added tests for different scenarios
@IlyaSkriblovsky tests and options updated ✅ Let me know if you think that covers everything. I have run the tests against my own 3.6 instance as well. |
Looks great, thank you! |
\o/ Cheers! |
@psi29a done! |
Merging! Thank you! |
Mongo 3.6 requires either an
explain
or acursor
option with theaggregate
command. This update adds acursor
option with a default initial batch size of0
(which allows the cursor to quickly return without doing work in case of an error -- see Mongo docsWithout this, any
aggregate
query will fail in Mongo 3.6+This patch gets it back running again, but does not expose the
cursor
option to the calling command. Should it provide a default and also allow that option to be set? The cursor option is a dictionary, but looking at the docs, it appears that it only has one key --batchSize
, so I would think we could just exposeinitial_batch_size
as a keyword argument, and set it to some reasonable default.