[SERVER-27422] Agg Pipeline return none type on from AVG func - is it working differently in 3.08 v 3.2.11 Created: 14/Dec/16 Updated: 27/Oct/23 Resolved: 14/Dec/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Question | Priority: | Major - P3 |
| Reporter: | Richard Bowyer | Assignee: | Unassigned |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
3.2.11 |
||
| Attachments: |
|
||||||||||||||||
| Issue Links: |
|
||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
Same exact code run from Python IDE and same data (copy) in Mongo 3.08 v 3.2.11 is yielding different results. The agg pipeline has an AVG function and the results are feed into a round function. When I run v. the upgraded database (same exact python code), I get none type from the agg pipeline. When I run v. legacy, I don't -> I get float types. |
| Comments |
| Comment by Kelsey Schubert [ 14/Dec/16 ] | |||||
|
Hi bowyerr, As Bernie described, this is the expected behavior resulting from the change in We understand that this was a backwards breaking change, but believe that the improvements were worthwhile. Previously, you could not determine if an average was 0 because there were nonnumeric fields or because the the numeric average of the fields was 0. If you are seeing null values being returned to your application, and would like to be seeing 0 instead, please append the following stage following the $avg stage in your aggregation where average the field containing your commuted average:
This workaround should restore the previous behavior. Kind regards, | |||||
| Comment by Richard Bowyer [ 14/Dec/16 ] | |||||
|
I need to know what changed in which function(s) and the recommend remediation. | |||||
| Comment by Richard Bowyer [ 14/Dec/16 ] | |||||
|
Wait a minute. Worked in old, but not in new. That is NOT worked as designed as a resolution. Please reopen and try again. | |||||
| Comment by Bernie Hackett [ 14/Dec/16 ] | |||||
|
It looks like the behavior change is a result of | |||||
| Comment by Richard Bowyer [ 14/Dec/16 ] | |||||
|
File attached | |||||
| Comment by Bernie Hackett [ 14/Dec/16 ] | |||||
|
If you can send an example agg pipeline that reproduces the problem I would be happy to debug this further with the server team. Otherwise I'll close this ticket Won't Fix, since there is no way to fix this in PyMongo. | |||||
| Comment by Richard Bowyer [ 14/Dec/16 ] | |||||
|
Agree. I believe that this had nothing to do with Pymongo and everything to do with a change in behavior with the Agg Pipeline between the versions. | |||||
| Comment by Bernie Hackett [ 14/Dec/16 ] | |||||
|
Hi, Can you send an example pipeline? I doubt this has anything to do with PyMongo. It sounds like a change in server behavior between 3.0 and 3.2. |