findAndModify behaviour unexpected for upsert scenarios

XMLWordPrintableJSON

    • Type: Question
    • Resolution: Done
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • 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 Stearn
              Reporter:
              Remon van Vliet
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: