Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-13015

2.6.0-rc0: Update that violates sparse index is not done, generates no complaint.

    • Type: Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Write Ops
    • None
    • Fully Compatible
    • ALL

      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
      >
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            william.cross William Cross
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: