Details
-
Bug
-
Resolution: Cannot Reproduce
-
Major - P3
-
None
-
None
-
None
-
Fully Compatible
-
ALL
Description
When updating a value to another value that it cannot take because of a unique index, the update fails, but no error is generated.
This is bad b/c the update method found the document, and would have performed the update without the index, but does not complain. Users may think the update worked awesomely, but be wrong.
Steps to Reproduce:
> db.moo.drop()
|
> db.moo.insert({a: 1})
|
> db.moo.insert({a: 2})
|
> db.moo.find()
|
{ "_id" : ObjectId("53150cb99b76858b68c2631a"), "a" : 1 }
|
{ "_id" : ObjectId("53150cbc9b76858b68c2631b"), "a" : 2 }
|
> db.moo.ensureIndex({a: 1}, {unique: true})
|
> db.moo.update({a: 2}, {a: 1})
|
> db.moo.find()
|
{ "_id" : ObjectId("53150cb99b76858b68c2631a"), "a" : 1 }
|
{ "_id" : ObjectId("53150cbc9b76858b68c2631b"), "a" : 2 }
|
> db.getLastError()
|
null
|
>
|
Attachments
Issue Links
- is duplicated by
-
SERVER-13036 2.6 shell silently ignores duplicate key error when connecting to 2.4 server
-
- Closed
-