[SERVER-61042] $_internalUnpackBucket can swap with $sort without checking for top-k Created: 27/Oct/21  Updated: 29/Oct/23  Resolved: 08/Nov/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.2.0

Type: Bug Priority: Major - P3
Reporter: Matt Boros Assignee: Katherine Wu (Inactive)
Resolution: Fixed Votes: 0
Labels: quick-tech-debt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

Under certain conditions doOptimizeAt in _internalUnpackBucket will swap with a sort without checking if the sort has an internal limit. Since we optimize the pipeline from left to right, this does not cause any issues. However it's possible this could cause a bug in the future where we provide more results to the user than expected by accidentally pushing the limit back.



 Comments   
Comment by Githook User [ 08/Nov/21 ]

Author:

{'name': 'Katherine Wu', 'email': 'katherine.wu@mongodb.com', 'username': 'kaywux'}

Message: SERVER-61042 Preserve limit when swapping $sort and $_internalUnpackBucket
Branch: master
https://github.com/mongodb/mongo/commit/dddb4744ea5c2f19b97239bafaa2abdf11050b31

Generated at Thu Feb 08 05:51:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.