[DOCS-1669] aggregation $group reverses previous $sort Created: 02/Jul/13 Updated: 25/Aug/19 Resolved: 02/Jul/13 |
|
| Status: | Closed |
| Project: | Documentation |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Oleksii Lomako | Assignee: | Sam Kleinman (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | aggregation, group, sort | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
win7 64bit |
||
| Attachments: |
|
| Participants: | |
| Days since reply: | 4 years, 24 weeks, 4 days ago |
| Description |
|
aggregation $group operation reverses previous $sort operation. this must be fixed or documented in $group and $sort that $sort will be broken /reverted if it was used before $group |
| Comments |
| Comment by Hassan Faghihi [ 25/Aug/19 ] |
|
Just curious, and unrelated... what's `u` in that json? is it valid? or it used in specific language? |
| Comment by Billy Tetrud [ 24/Jun/16 ] |
|
Why does $group eff up the sort? This seems unnecessarily confusing to me. |
| Comment by Sam Kleinman (Inactive) [ 02/Jul/13 ] |
|
The first $sort can use an index if there are no $project, $unwind or $group pipeline stages that proceed the $sort. |
| Comment by auto [ 02/Jul/13 ] |
|
Author: {u'username': u'tychoish', u'name': u'Sam Kleinman', u'email': u'samk@10gen.com'}Message: |
| Comment by auto [ 02/Jul/13 ] |
|
Author: {u'username': u'tychoish', u'name': u'Sam Kleinman', u'email': u'samk@10gen.com'}Message: |
| Comment by Oleksii Lomako [ 02/Jul/13 ] |
|
Am i right that we cannot rely on such sorting "invertion" and must use $sort second time after $group? does first $sort make any optimization (we assume that we have index on keys)? |
| Comment by Eliot Horowitz (Inactive) [ 02/Jul/13 ] |
|
This is definitely as expected. The output of group is by definition not-ordered, that should be clear in the docs. |