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

findAndModify behaviour unexpected for upsert scenarios

    XMLWordPrintable

    Details

    • Type: Question
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Works as Designed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Querying
    • Labels:
      None

      Description

      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?

        Attachments

          Activity

            People

            Assignee:
            redbeard0531 Mathias Stearn
            Reporter:
            remonvv Remon van Vliet
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: