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

$set: {} is now rejected by the update framework, but worked as a noop prior to 2.6

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • 2.6.1
    • None
    • Write Ops
    • None
    • ALL
    • Hide

      > db.runCommand({ findAndModify: "foo", query:{_id: ObjectId("536beb62fe2ac487fb241614")}, update:{$set : {} }, upsert:true} )
      {
      	"value" : null,
      	"errmsg" : "exception: '$set' is empty. You must specify a field like so: {$mod: {<field>: ...}}",
      	"code" : 9,
      	"ok" : 0
      }
      > db.foo.update({_id: ObjectId("536beb62fe2ac487fb241614")},{$set:{}},true)
      WriteResult({
      	"nMatched" : 0,
      	"nUpserted" : 0,
      	"nModified" : 0,
      	"writeError" : {
      		"code" : 9,
      		"errmsg" : "'$set' is empty. You must specify a field like so: {$mod: {<field>: ...}}"
      	}
      })

      Show
      > db.runCommand({ findAndModify: "foo", query:{_id: ObjectId("536beb62fe2ac487fb241614")}, update:{$set : {} }, upsert:true} ) { "value" : null, "errmsg" : "exception: '$set' is empty. You must specify a field like so: {$mod: {<field>: ...}}", "code" : 9, "ok" : 0 } > db.foo.update({_id: ObjectId("536beb62fe2ac487fb241614")},{$set:{}},true) WriteResult({ "nMatched" : 0, "nUpserted" : 0, "nModified" : 0, "writeError" : { "code" : 9, "errmsg" : "'$set' is empty. You must specify a field like so: {$mod: {<field>: ...}}" } })

    Description

      > db.runCommand({ findAndModify: "foo", query:{_id: ObjectId("536beb62fe2ac487fb241614")}, update:{$set : {} }, upsert:true} )
      {
      	"value" : null,
      	"errmsg" : "exception: '$set' is empty. You must specify a field like so: {$mod: {<field>: ...}}",
      	"code" : 9,
      	"ok" : 0
      }
      > db.foo.update({_id: ObjectId("536beb62fe2ac487fb241614")},{$set:{}},true)
      WriteResult({
      	"nMatched" : 0,
      	"nUpserted" : 0,
      	"nModified" : 0,
      	"writeError" : {
      		"code" : 9,
      		"errmsg" : "'$set' is empty. You must specify a field like so: {$mod: {<field>: ...}}"
      	}
      })

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              matt.dannenberg Matt Dannenberg
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: