[SERVER-66563] prepareUnique: true should not change the index spec when the index is already unique Created: 18/May/22  Updated: 29/Oct/23  Resolved: 06/Jun/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: Wenbin Zhu Assignee: Yuhong Zhang
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2022-06-13
Participants:

 Description   

Currently if you call prepareUnique: true on a unique index, the index spec will still be changed, which is kind of confusing:

{
		"v" : 2,
		"key" : {
			"a" : 1
		},
		"name" : "a_unique",
		"unique" : true,
		"prepareUnique" : true
} 

It seems prepareUnique: true should just be a noop on a unique index, and not change the index spec.



 Comments   
Comment by Githook User [ 03/Jun/22 ]

Author:

{'name': 'Yuhong Zhang', 'email': 'yuhong.zhang@mongodb.com', 'username': 'YuhongZhang98'}

Message: SERVER-66563 Clarify the usage of prepareUnique index option with more tests
Branch: master
https://github.com/mongodb/mongo/commit/3fa065e377c94114df79d6a9fc4d3ee04f4d286e

Comment by Yuhong Zhang [ 02/Jun/22 ]

The issue should have been fixed in commit fcb9d766b6f66e6a9cfabe1795c1e9d43465b151 which was merged in 6.0.0-rc0 and 6.1.0-rc0. I'll add some jstests using this ticket.

Comment by Wenbin Zhu [ 18/May/22 ]

cc pavithra.vetriselvan@mongodb.com lingzhi.deng@mongodb.com m.maher@mongodb.com

This is not urgent, but nice if is fixed.

Generated at Thu Feb 08 06:05:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.