[SERVER-8633] ensureIndex does not enforce constraints until collection exists Created: 20/Feb/13  Updated: 06/Dec/22  Resolved: 22/May/18

Status: Closed
Project: Core Server
Component/s: Index Maintenance
Affects Version/s: 2.3.2, 2.4.0-rc0
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Ed Costello Assignee: Backlog - Query Team (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

OS X


Issue Links:
Depends
Assigned Teams:
Query
Operating System: ALL
Steps To Reproduce:

> use qa
switched to db qa
> db.test.ensureIndex({ts:"hashed"}, {hashVersion:1})
> db.test.insert({ts:ISODate()})
Only HashVersion 0 has been defined
> db.dropDatabase()
{ "dropped" : "qa", "ok" : 1 }

Expected behavior:

> use qa
switched to db qa
> db.test.insert({ts:ISODate()})
> db.test.ensureIndex({ts:"hashed"}, {hashVersion:1})
{
	"err" : "Only HashVersion 0 has been defined",
	"code" : 16245,
	"n" : 0,
	"connectionId" : 5,
	"ok" : 1
}

Participants:

 Description   

ensureIndex does not enforce constraints such as hashVersion can only be 0 until data exists in collection.



 Comments   
Comment by Eric Milkie [ 22/May/18 ]

This style of hashed index creation is no longer supported by the server.

Generated at Thu Feb 08 03:17:57 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.