[SERVER-34974] Dup key value is not readable in error message when unique index is created with collation Created: 14/May/18  Updated: 18/May/18  Resolved: 18/May/18

Status: Closed
Project: Core Server
Component/s: Index Maintenance
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Vasily Kopyl Assignee: Asya Kamsky
Resolution: Duplicate Votes: 0
Labels: collation
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-26050 Unique key violation for index with a... Backlog
Operating System: ALL
Steps To Reproduce:

db.createCollection('people')
db.people.insert({userName: 'Bob'})
db.people.insert({userName: 'Sally'})

db.people.createIndex({userName: 1}, {unique: true, collation: { locale: 'en', strength: 2}})

db.people.insert({userName: 'BOB'})

 

The last method throws the error:

WriteResult({WriteResult({ "nInserted" : 0, "writeError" : { "code" : 11000, "errmsg" : "E11000 duplicate key error collection: members.people index: userName_1 dup key: { : \"E\u0001\u0007\" }" }})

 

Expected:

WriteResult({WriteResult({ "nInserted" : 0, "writeError" : { "code" : 11000, "errmsg" : "E11000 duplicate key error collection: members.people index: userName_1 dup key: { : \"BOB\" }" }})

 

 

Participants:

 Description   

Duplicate key error message reports the key value in unreadable form. This occurs if an index created with collation. 

 

 



 Comments   
Comment by Asya Kamsky [ 18/May/18 ]

This seems to be a duplicate of SERVER-26050

Generated at Thu Feb 08 04:38:26 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.