[SERVER-26726] Check number of arguments for createIndex() and throw error if more than two arguments Created: 21/Oct/16 Updated: 04/Mar/21 Resolved: 24/Aug/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Shell |
| Affects Version/s: | 3.2.9 |
| Fix Version/s: | 4.7.0, 4.2.10, 4.4.2, 4.0.21, 3.6.21 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Manan Shah | Assignee: | Nikita Lapkov (Inactive) |
| Resolution: | Done | Votes: | 5 |
| Labels: | move-sa, neweng, qexec-team | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Backwards Compatibility: | Minor Change | ||||||||||||||||||||||||
| Backport Requested: |
v4.4, v4.2, v4.0, v3.6
|
||||||||||||||||||||||||
| Sprint: | Query 2020-08-24, Query 2020-09-07 | ||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||
| Case: | (copied to CRM) | ||||||||||||||||||||||||
| Description |
|
If a third argument is passed to the ensureIndex() with valid options, then the behavior is to ignore the third argument instead of an error. So for example, if I execute the following
the third argument which is critical to the purpose of this index build is completely ignored and the index is built in the foreground with no sparse option. This can lead to catastrophic events if myColl is very large and foreground index was not a choice. Can this be fixed so a user is not punished for accidentally passing the critical options as a third argument in the index build? The version we tried this is 3.2.9 |
| Comments |
| Comment by Githook User [ 11/Sep/20 ] |
|
Author: {'name': 'Nikita Lapkov', 'email': 'nikita.lapkov@mongodb.com', 'username': 'laplab'}Message: (cherry picked from commit be07da4bd6dd394947236857f5510a7ba9c3b0a4) |
| Comment by Githook User [ 09/Sep/20 ] |
|
Author: {'name': 'Nikita Lapkov', 'email': 'nikita.lapkov@mongodb.com', 'username': 'laplab'}Message: (cherry picked from commit be07da4bd6dd394947236857f5510a7ba9c3b0a4) |
| Comment by Githook User [ 09/Sep/20 ] |
|
Author: {'name': 'Nikita Lapkov', 'email': 'nikita.lapkov@mongodb.com', 'username': 'laplab'}Message: (cherry picked from commit be07da4bd6dd394947236857f5510a7ba9c3b0a4) |
| Comment by Githook User [ 09/Sep/20 ] |
|
Author: {'name': 'Nikita Lapkov', 'email': 'nikita.lapkov@mongodb.com', 'username': 'laplab'}Message: (cherry picked from commit be07da4bd6dd394947236857f5510a7ba9c3b0a4) |
| Comment by Manan Shah [ 21/Aug/20 ] |
|
Thanks for the update. |
| Comment by Nikita Lapkov (Inactive) [ 21/Aug/20 ] |
|
Hey! To fix this issue we have added validation of number of arguments in shell functions createIndex, createIndexes and ensureIndex. Changes will be backported to versions 4.4, 4.2, 4.0 and 3.6 |
| Comment by Githook User [ 21/Aug/20 ] |
|
Author: {'name': 'Nikita Lapkov', 'email': 'nikita.lapkov@mongodb.com', 'username': 'laplab'}Message: |
| Comment by Manan Shah [ 12/May/17 ] |
|
Is there an update here? |
| Comment by Manan Shah [ 21/Oct/16 ] |
|
Thanks. That would be a reasonable request. |
| Comment by Ramon Fernandez Marina [ 21/Oct/16 ] |
|
If I understand correctly, this is a "feature" in JavaScript, so I'm repurposing this as an improvement request and sending it to the Platforms team to evaluate whether the shell can be improved here to protect against this case. Thanks, |