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

Upsert With Modifiers In Find Throws Exception

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.0.0, 2.2.0
    • Component/s: Write Ops
    • Labels:
      None
    • Environment:
      centos, mongo command-line client, mongo ruby driver
    • Linux

      This may affect more versions, but I've only tested on 2.2.0 and 2.0.0.

      Trying to do an upsert with a $not modifier in the find:

      db.counters.update({"_id" : {a: 5, b:10}, "$not":{"value.tx":"5d"}}, {"$inc":{"value.c":4}, "$set":{"value.tx":"5d"}}, true)
      

      Works for the first insert. But the second always fails with the following exception, no matter what $not is set to:

      E11000 duplicate key error index: databaseone.counters.$_id_  dup key: { : { a: 5.0, b: 10.0 } }
      

            Assignee:
            andrew.emil@10gen.com Andrew Emil (Inactive)
            Reporter:
            wwatson William Watson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: