[SERVER-12932] Fix grammar errors in update Created: 27/Feb/14  Updated: 22/Feb/16  Resolved: 04/Feb/16

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: 2.6.0-rc0, 2.6.11, 3.2.1, 3.3.1
Fix Version/s: 3.3.2

Type: Bug Priority: Minor - P4
Reporter: Jonathan Abrahams Assignee: James Wahlin
Resolution: Done Votes: 0
Labels: 26qa, neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-12992 Error message for $mul with non-numer... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

var qa380_db = db.getSiblingDB("qa380");
var coll = qa380_db.foo;
 
coll.update({n : 0}, {$mul: {n : '' }})

1. Error message: "Cannot increment with non-numeric argument:"
Should be: "Cannot apply $mul to a value of non-numeric type."

coll.update({ n : 9}, {$push: {x: {$each: [1, 2], $slice: {a: 1}}}})

2. Error message: "The value for $slice must be a numeric value not a Object"
Should be: "The value for $slice must be a numeric value not an Object"

coll.update({n : 10}, {$push: {x: {$sort:{a:1}}}})

3. No longer generates an error (it did in 2.5.x): "$sort is not valid for storage."

coll.update({n : 4}, {$push: {x: {$each:[{a:3},{a:2},{a:1}],$sort:{a:-1}}}})

4. No longer generates an error (it did in 2.5.x): "The field 'x' must be and array but is of type NumberLong64 in document"

coll.update({n:4},{$bit:[]})

5. Error message: "Modifiers operate on fields but we found a Array instead"
Should be: "Modifiers operate on fields but we found an Array instead"

Participants:

 Description   

Based on testing (QA-380) in 2.5 and 2.6 there were many changes to the WriteResult. Some error messages are no longer generated or are syntactically or grammatically incorrect.



 Comments   
Comment by Githook User [ 04/Feb/16 ]

Author:

{u'username': u'jameswahlin', u'name': u'James Wahlin', u'email': u'james.wahlin@10gen.com'}

Message: SERVER-12932 Fix grammer errors in push and update
Branch: master
https://github.com/mongodb/mongo/commit/5d6b9725a3da28fd1114cf1c45f41f3837578b51

Comment by Jonathan Abrahams [ 03/Mar/14 ]

First case has been removed from this ticket and is being tracked as SERVER-12992

Comment by Daniel Pasette (Inactive) [ 02/Mar/14 ]

Numbered for better clarity. In general, it's hard to triage these unrelated items in a single ticket. Better to put the grammar changes in one ticket and submit the others separately.

Number 1 is piggy-backing on $inc, so may not be easy to fix this message.
Number 2 and 5 are very simple grammar fixes.
Number 3 and 4 are not bugs – the error msg won't be triggered unless the update or upsert tries to modify a document. In this case, the code correctly triggered (i checked both cases).

> coll.insert({n:4, x:1})
WriteResult({ "nInserted" : 1 })
> coll.update({n : 4}, {$push: {x: {$each:[{a:3},{a:2},{a:1}],$sort:{a:-1}}}})
WriteResult({
	"nMatched" : 0,
	"nUpserted" : 0,
	"nModified" : 0,
	"writeError" : {
		"code" : 16837,
		"errmsg" : "The field 'x' must be an array but is of type NumberDouble in document {_id: ObjectId('5313bb0fd50adcba2c2f7ab7')}"
	}
})

We can track the grammar issues with this ticket.

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