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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker - P1
    • Resolution: Fixed
    • Affects Version/s: 3.0.0-rc9, 3.0.0-rc10
    • Fix Version/s: 3.0.0-rc11, 3.1.0
    • Component/s: Querying
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Completed:
    • Steps To Reproduce:
      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 }
    • Sprint:
      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

              • Votes:
                0 Vote for this issue
                Watchers:
                16 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: