[SERVER-13930] Confusing message with hardcoded operator name on empty $set Created: 13/May/14  Updated: 04/Sep/14  Resolved: 15/May/14

Status: Closed
Project: Core Server
Component/s: Usability
Affects Version/s: 2.6.0, 2.6.1
Fix Version/s: 2.7.1

Type: Improvement Priority: Trivial - P5
Reporter: Valeri Karpov Assignee: Matt Kangas
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Sprint: Server 2.7.1
Participants:

 Description   

> db.test.update({}, { $set : {} });
WriteResult({
"nMatched" : 0,
"nUpserted" : 0,
"nModified" : 0,
"writeError" : {
"code" : 9,
"errmsg" : "'$set' is empty. You must specify a field like so: {$mod: {<field>: ...}}"
}
})

Ideally should output

"'$set' is empty. You must specify a field like so: {$set: {<field>: ...}}"

instead.



 Comments   
Comment by Githook User [ 15/May/14 ]

Author:

{u'username': u'vkarpov15', u'name': u'Valeri Karpov', u'email': u'valeri.karpov@10gen.com'}

Message: SERVER-13930 Don't hardcode "$mod" in error message

Signed-off-by: Benety Goh <benety@mongodb.com>
Branch: master
https://github.com/mongodb/mongo/commit/71cbb04eb8262b0bdf255056f26101466c11b43d

Comment by Benety Goh [ 15/May/14 ]

new error message:

> db.test.update({}, {$set: {}})
WriteResult({
	"nMatched" : 0,
	"nUpserted" : 0,
	"nModified" : 0,
	"writeError" : {
		"code" : 9,
		"errmsg" : "'$set' is empty. You must specify a field like so: {$set: {<field>: ...}}"
	}
})

Comment by Benety Goh [ 15/May/14 ]

existing test case:

TEST(Parse, EmptyMod) {
        UpdateDriver::Options opts;
        UpdateDriver driver(opts);
        ASSERT_NOT_OK(driver.parse(fromjson("{$set:{}}")));
}

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