[SERVER-2054] Creating an index with dropDups shouldn't assert Created: 02/Nov/10  Updated: 12/Jul/16  Resolved: 01/Aug/11

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

Type: Bug Priority: Major - P3
Reporter: Kyle Banker Assignee: Aaron Staple
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-2580 ensureIndex with unique:true and drop... Closed
Operating System: ALL
Participants:

 Description   

> db.g.save({a: 1})
> db.g.save({a: 1})
> db.g.find()
{ "_id" : ObjectId("4cd05a0ae109fa5c133e277a"), "a" : 1 }
{ "_id" : ObjectId("4cd05a0be109fa5c133e277b"), "a" : 1 }
> db.g.ensureIndex({a: 1}, {unique: true, dropDups: true})
E11000 duplicate key error index: test.g.$a_1  dup key: { : 1.0 }
> db.g.find()
{ "_id" : ObjectId("4cd05a0ae109fa5c133e277a"), "a" : 1 }

If the user specifies dropDups: true, there's no reason for the server to assert. This is a problem in the drivers, where we check for assertions when creating indexes.



 Comments   
Comment by auto [ 31/Jul/11 ]

Author:

{u'login': u'astaple', u'name': u'Aaron', u'email': u'aaron@10gen.com'}

Message: SERVER-2054 don't uassert due to unique index constraint violation in dropdups mode
Branch: master
https://github.com/mongodb/mongo/commit/23c7fefdfe2a798027e47bb684424feeb130ad91

Generated at Thu Feb 08 02:58:50 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.