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

With upserts key can be in query or mod

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.5.2
    • Affects Version/s: None
    • Component/s: Sharding
    • None

      These will work correctly:
      upsert({_id:FOO},

      {key:BAR, other:1}

      )
      upsert({_id:FOO, key:BAR}, {$set: {other: 1}})
      upsert({_id:FOO, key:BAR},

      {other:1}

      ) // converted to the first example.

      This must fail:
      upsert({_id:FOO, key:BAR},

      {key:BAZ}

      )

      This can cause dup IDs but wont fail until/unless we get unique indexes working across shards:
      upsert({_id:FOO, key:BAR}, {$set: {other:1}})
      upsert({_id:FOO, key:BAZ}, {$set: {other:1}})

            Assignee:
            mathias@mongodb.com Mathias Stearn
            Reporter:
            mathias@mongodb.com Mathias Stearn
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: