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

Upsert results in E11000 duplicate key error

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: WiredTiger
    • Labels:
    • Environment:
      Ubuntu 14.04 3.16.0-43 64bit, 16GB RAM, i5-4690 CPU @ 3.50GHz

      I'm basically upserting documents that has random sid 1..100, and then update the hit counter on them.

      So the document looks like that:

      { 'sid': 23, 'status': 'active' 'hit': 12 }

      A timer changes the status field from 'active' to something else occasionally.

      That program runs successfully on mongodb 3.0.4 with MMAPv1 engine, but throws E11000 errors with wiredtiger.

      javascript code to replicate:
      https://github.com/yurynix/mongodb-upsert-test

      It's a reduced case of my more complicated python code (pymongo 3.0.3), which has the same problem.

      expected result:
      https://github.com/yurynix/mongodb-upsert-test/blob/master/expected.txt
      (thats the result with the default engine)

      actual result:
      https://github.com/yurynix/mongodb-upsert-test/blob/master/actual.txt

      Best regards,
      Yury.

            Assignee:
            ramon.fernandez@mongodb.com Ramon Fernandez Marina
            Reporter:
            yurynix Yury Michurin
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: