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

upserts handle operators (i.e. $exists) in a manner inconsistent with inserts

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.6.4
    • Affects Version/s: 2.2.2, 2.4.11, 2.6.3
    • Component/s: Write Ops
    • None
    • Environment:
      Debian
    • ALL
    • Hide
      shape:PRIMARY> db.foo.update({_id: {year: 2012, url: {$exists: false}}}, {$inc: {bar: 1}}, {upsert: true})
      
      shape:PRIMARY> db.foo.find()
      { "_id" : { "year" : 2012, "url" : { "$exists" : false } }, "bar" : 1 }
      
      Show
      shape:PRIMARY> db.foo.update({_id: {year: 2012, url: {$exists: false }}}, {$inc: {bar: 1}}, {upsert: true }) shape:PRIMARY> db.foo.find() { "_id" : { "year" : 2012, "url" : { "$exists" : false } }, "bar" : 1 }

      During an upsert inserting a document, {$exists: false} can be inserted in the collection.

            Assignee:
            ramon.fernandez@mongodb.com Ramon Fernandez Marina
            Reporter:
            root Julien
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: