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

findAndModify behaviour unexpected for upsert scenarios

    • Type: Icon: Question Question
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • None

      This returns an empty document rather than null/nothing :
      db.test.findAndModify({query:

      {a:1}

      , update : {$set : { a:2}}, fields:

      {tasks:1}

      , upsert:true} )

      This returns a document with only the _id set rather than the entire newly inserted document :
      db.test.findAndModify({query:

      {a:1}

      , update : {$set : { a:2}}, fields:

      {tasks:1}

      , upsert:true, new: true } )

      Is this intended? If so, is it useful to open a JIRA issue to change this?

            Assignee:
            mathias@mongodb.com Mathias Stearn
            Reporter:
            remonvv Remon van Vliet
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: