-
Couldn't load subscription status.
- Fork 1.2k
aggregate_sum/average + unit tests #1021
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
Conversation
|
|
|
Thanks @thedrow, the latest commit fixes it. |
|
|
|
Thanks @wojcikstefan ! to: Thanks ! |
|
To all: |
|
One more point before merge: @wojcikstefan please add this to the changelog ! |
|
@MRigal thanks - glad you pay attention! I added a changelog entry and simplified the code. Not sure about deprecating |
|
|
|
@thedrow @DavidBord why the fuck did Travis didn't start a build Job here???!?!? I have no clue how to start one now... |
|
@wojcikstefan I would have eventually solved the conflict by hand, but since the tests didn't started, could you please rebase the branch and push, with the hope it will launch a test run on travis... |
4e0b54d to
b7ef82c
Compare
|
@MRigal I rebased against the latest master. It seems to have triggered a Travis build. |
|
|
aggregate_sum/average + unit tests
|
Thanks @wojcikstefan ! |
|
Thanks @wojcikstefan for this contribution. I found those methods by accident while looking in the code. They are not documented in the doc. @MongoEngine/mongoengine, what would make more sense? Adding a note to the docs? Replace old sum() and average() and drop old map/reduce methods? Are there cases not covered by those aggregate_* methods? (Old MongoDB, old pymongo, specific configuration,...) |
|
I think it would make sense to replace the original methods with the new ones. I believe it's supported by all versions of MongoDB >= 2.2 when the aggregation framework was introduced. Also, the less raw JS code in MongoEngine, the better IMHO :) Curious what @thedrow thinks about this! |
Closes #569
@MRigal here's the implementation of sum & average using the aggregation framework. I haven't tested it in a sharded environment, but if it works, I believe it could fully replace the slower, map-reduce-based
BaseQuerySet.sumandBaseQuerySet.average.