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

findAndModify behaviour unexpected for upsert scenarios

    XMLWordPrintable

Details

    • Question
    • Status: Closed
    • Minor - P4
    • Resolution: Works as Designed
    • None
    • None
    • Querying
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: