[SERVER-11064] Stricter validation of index key patterns during index creation and startup Created: 07/Oct/13 Updated: 17/May/19 Resolved: 27/Jan/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 2.4.6 |
| Fix Version/s: | 3.3.1 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Oleg Rekutin | Assignee: | Max Hirschhorn |
| Resolution: | Done | Votes: | 0 |
| Labels: | neweng, query_triage | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||||||||||||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||
| Backwards Compatibility: | Major Change | ||||||||||||||||||||||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||||||||||||||||||||||
| Sprint: | Query F (02/01/16) | ||||||||||||||||||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||||||||||||||||||
| Linked BF Score: | 0 | ||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
The values in the index key pattern will be restricted to
Some specific values that may be of interest for which an error will be returned under the new scheme:
Original descriptionensureIndex permits any numeric value to be passed as the sort order. Negative values indicate descending order, greater than or equal to zero indicate ascending. We should just limit to 1 and -1. This was partially fixed with |
| Comments |
| Comment by Githook User [ 27/Jan/16 ] |
|
Author: {u'username': u'visemet', u'name': u'Max Hirschhorn', u'email': u'max.hirschhorn@mongodb.com'}Message: Each value in the index key pattern must be one of the following:
Since the key pattern is validated on startup for all existing indexes, Additionally, if an index with an invalid key pattern is replicated from |
| Comment by Max Hirschhorn [ 25/Jan/16 ] |
|
Updating the description of this ticket after discussing with members of the drivers team about the following two questions:
|
| Comment by David Storch [ 21/Dec/15 ] |
|
Not sure that we should disallow numeric values other than +1/-1, but it seems non-controversial to reject the following kinds of values:
|
| Comment by David Storch [ 12/Nov/13 ] |
|
Attaching a js test that should pass once this issue is resolved. |
| Comment by Oleg Rekutin [ 07/Oct/13 ] |
|
Sort direction "0" is not a valid direction. This is what causes this behavior. PEBKAC, sorry. You can close this as invalid. Or change this issue in having ensureIndices validate the input, such that you can't create an index with an invalid sort direction. |