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

FindAndModify no longer returns "value" if upsert results in an insert and "new" is false

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker - P1
    • Resolution: Fixed
    • 3.0.0-rc9, 3.0.0-rc10
    • 3.0.0-rc11, 3.1.0
    • Querying
    • None
    • Fully Compatible
    • ALL
    • Hide

      To reproduce, run a 3.0.0-rc8 server:

      > db.test.remove({})
      > db.runCommand({findAndModify: "test", query: {_id: "miss"}, update: {$set: {y:2}}, upsert: true})
      {
              "value" : null,
              "lastErrorObject" : {
                      "updatedExisting" : false,
                      "n" : 1,
                      "upserted" : "miss"
              },
              "ok" : 1
      }

      Here is the result with a 3.0.0-rc9 (and 3.0.0-rc10) server:

      > db.test.remove({})
      > result = db.runCommand({findAndModify: "test", query: {_id: "miss"}, update: {$set: {y:2}}, upsert: true})
      {
              "lastErrorObject" : {
                      "updatedExisting" : false,
                      "n" : 1,
                      "upserted" : "miss"
              },
              "ok" : 1
      }

      Show
      To reproduce, run a 3.0.0-rc8 server: > db.test.remove({}) > db.runCommand({findAndModify: "test", query: {_id: "miss"}, update: {$set: {y:2}}, upsert: true}) { "value" : null, "lastErrorObject" : { "updatedExisting" : false, "n" : 1, "upserted" : "miss" }, "ok" : 1 } Here is the result with a 3.0.0-rc9 (and 3.0.0-rc10) server: > db.test.remove({}) > result = db.runCommand({findAndModify: "test", query: {_id: "miss"}, update: {$set: {y:2}}, upsert: true}) { "lastErrorObject" : { "updatedExisting" : false, "n" : 1, "upserted" : "miss" }, "ok" : 1 }
    • Quint 3.1.0

    Description

      From 3.0.0-rc8 to 3.0.0-rc9, the server has stopped returning the "value" field from a findAndModify command under certain conditions.

      This is causing the .NET driver, for instance, to throw an exception where null used to be returned. Certainly, we could alter the driver to check if the field exists first, but this is a change to the server's API and affects all versions of the .NET driver currently released.

      Attachments

        Issue Links

          Activity

            People

              david.storch@mongodb.com David Storch
              craig.wilson@mongodb.com Craig Wilson
              Votes:
              0 Vote for this issue
              Watchers:
              15 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: