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

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Blocker - P1
    • 3.0.0-rc11, 3.1.0
    • Affects Version/s: 3.0.0-rc9, 3.0.0-rc10
    • Component/s: 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
    • None
    • 0
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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.

              Assignee:
              David Storch
              Reporter:
              Craig Wilson
              Votes:
              0 Vote for this issue
              Watchers:
              15 Start watching this issue

                Created:
                Updated:
                Resolved: