Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-7935

db.collection.update discrepancy with upsert

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • 01112017-cleanup
    • None
    • None
    • None

    Description

      https://docs.mongodb.com/manual/reference/method/db.collection.update/#behavior

      It appears that

      db.collection.update({_id:null}, {field"test"}, {upsert:true})
      

      might be implicitly rewritten as

      db.collection.update({_id:null}, {$set: {field"test"}}, {upsert:true})
      

      resulting in unexpected behavior.

      This is probably worth testing in an older version (is the behavior consistent in 2.6.1?).

      Attachments

        Activity

          People

            jonathan.destefano@mongodb.com Jonathan DeStefano
            kevin.arhelger@mongodb.com Kevin Arhelger
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              7 years, 31 weeks, 6 days ago