Details
-
Task
-
Status: Closed
-
Critical - P2
-
Resolution: Done
-
None
-
1
-
KANBAN BUCKET
Description
The values in the index key pattern are 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 now be returned:
- 0
- NaN
- undefined and null
- true and false
- MinKey and MaxKey
> db.mycoll.createIndex({a: 0})
|
{
|
"ok" : 0,
|
"errmsg" : "bad index key pattern { a: 0.0 }: Values in the index key pattern cannot be 0.",
|
"code" : 67
|
}
|
> db.mycoll.createIndex({a: NaN})
|
{
|
"ok" : 0,
|
"errmsg" : "bad index key pattern { a: nan.0 }: Values in the index key pattern cannot be NaN.",
|
"code" : 67
|
}
|
> db.mycoll.createIndex({a: true})
|
{
|
"ok" : 0,
|
"errmsg" : "bad index key pattern { a: true }: Values in index key pattern cannot be of type Bool. Only numbers > 0, numbers < 0, and strings are allowed.",
|
"code" : 67
|
}
|
Attachments
Issue Links
- documents
-
SERVER-11064 Stricter validation of index key patterns during index creation and startup
-
- Closed
-
- is related to
-
DOCS-9049 3.4: Mention stricter createIndexes validation in release notes
-
- Closed
-
- related to
-
SERVER-26659 Only apply stricter index key pattern validation to v:2 indexes
-
- Closed
-