[SERVER-13884] $set: {} is now rejected by the update framework, but worked as a noop prior to 2.6 Created: 08/May/14  Updated: 10/Dec/14  Resolved: 13/May/14

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: 2.6.1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Matt Dannenberg Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-12266 Update no longer allows empty modifie... Closed
Related
related to SERVER-13688 Picky errors from 2.6 are needlessly ... Closed
related to SERVER-13883 findAndModify() cannot take an empty ... Closed
Operating System: ALL
Steps To Reproduce:

> 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>: ...}}"
	}
})

Participants:

 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>: ...}}"
	}
})



 Comments   
Comment by Matt Dannenberg [ 13/May/14 ]

duplicates SERVER-12266 which has been resolved as 'works as designed'

Generated at Thu Feb 08 03:33:12 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.