[SERVER-62242] $indexOfArray does not work with duplicate values in array Created: 23/Dec/21 Updated: 29/Oct/23 Resolved: 07/Jan/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 4.4.14, 5.3.0, 5.0.7, 4.2.20, 5.2.2 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Jan Votava | Assignee: | Steve Tarzia |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
|||||||||||
| Backwards Compatibility: | Fully Compatible | |||||||||||
| Operating System: | ALL | |||||||||||
| Backport Requested: |
v5.2, v5.0, v4.4, v4.2, v4.0
|
|||||||||||
| Steps To Reproduce: |
|
|||||||||||
| Sprint: | QO 2022-01-10 | |||||||||||
| Participants: | ||||||||||||
| Description |
|
When array with duplicit values is supplied as a first argument to $indexOfArray, it starts returning `-1` when searching for subsequent values. |
| Comments |
| Comment by Githook User [ 09/Mar/22 ] | |||||||||
|
Author: {'name': 'Steve Tarzia', 'email': 'steve.tarzia@mongodb.com', 'username': 'starzia'}Message: | |||||||||
| Comment by Githook User [ 09/Mar/22 ] | |||||||||
|
Author: {'name': 'Steve Tarzia', 'email': 'steve.tarzia@mongodb.com', 'username': 'starzia'}Message: | |||||||||
| Comment by Githook User [ 09/Mar/22 ] | |||||||||
|
Author: {'name': 'Steve Tarzia', 'email': 'steve.tarzia@mongodb.com', 'username': 'starzia'}Message: | |||||||||
| Comment by Githook User [ 09/Mar/22 ] | |||||||||
|
Author: {'name': 'Steve Tarzia', 'email': 'steve.tarzia@mongodb.com', 'username': 'starzia'}Message: | |||||||||
| Comment by Githook User [ 07/Jan/22 ] | |||||||||
|
Author: {'name': 'Steve Tarzia', 'email': 'steve.tarzia@mongodb.com'}Message: | |||||||||
| Comment by Edwin Zhou [ 31/Dec/21 ] | |||||||||
|
Thank you for your report. I'm able to reproduce this issue on v5.0.5. This appears to happen only when there are duplicate values in the array and the specified search expression uses a field path. I will assign this ticket to the appropriate team. Best, | |||||||||
| Comment by Jan Votava [ 23/Dec/21 ] | |||||||||
|
Version 5.0.4, results in
|