-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 2.4.6
-
Component/s: Querying
-
Major Change
-
ALL
-
Query F (02/01/16)
-
0
The values in the index key pattern will be restricted to
- numbers > 0 (ascending)
- numbers < 0 (descending)
- strings (special index types)
Some specific values that may be of interest for which an error will be returned under the new scheme:
- 0
- NaN
- undefined and null
- true and false
- MinKey and MaxKey
Original description
ensureIndex 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 SERVER-5826, but only applies to non-numeric values.
- is duplicated by
-
SERVER-12538 Possible to create indexes with invalid orderings
- Closed
- related to
-
SERVER-26659 Only apply stricter index key pattern validation to v:2 indexes
- Closed
-
SERVER-5826 Creating an index using a non-existing plugin should be an error not a warning
- Closed
-
SERVER-11568 query optimizer fails to use index when sort spec is inconsistent with index spec
- Closed
-
SERVER-21663 Invalid parameter to ensureIndex can trigger server hang on operation
- Closed
-
SERVER-11374 Can create indexes on non-insertable fields (i.e. beginning with '$')
- Closed