[SERVER-11188] update $bit error messages are unclear Created: 15/Oct/13  Updated: 11/Jul/16  Resolved: 04/Dec/13

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: 2.5.3
Fix Version/s: 2.5.5

Type: Improvement Priority: Major - P3
Reporter: Amalia Hawkins Assignee: Scott Hernandez (Inactive)
Resolution: Done Votes: 0
Labels: 26qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
related to SERVER-11366 improve new update() error strings Closed
Participants:

 Description   

> coll.update({n : 0}, {$bit : { x : { foo : NumberInt(1) } }})
Only 'and', 'or', and 'xor' are supported $bit sub-operators

> coll.update({n : 0}, {$bit : { n : { foo : 2 } }})
Argument to $bit operation must be a NumberInt or NumberLong

I believe that the "sub-operators" error message in the first call should trigger in the second case as well. In other words, if the sub-operator and the argument to the sub-operator are both wrong, the sub-operator error message should trigger first.

Relatedly, "Argument to $bit sub-operation" is probably more correct than the current form.

=======

{ "_id" : ObjectId("525847b17bb5149dea3bb07e"), "n" : 0, "x" : 0 }
> coll.update({n : 0}, {$bit : { x : { or : NumberInt(1) } }})
Cannot apply $bit to a value of non-integral type

I think the error message should say something like, "cannot apply $bit to a value that is not NumberInt nor NumberLong".

=======

> db.foo.update({ n : 0 }, {$bit: {str : "hello"}})
Value following $bit must be an Object

It is an Object!

> db.foo.update({n:4},{$bit:[]})
List of mods must be an object

Shouldn't this error message be the one above?



 Comments   
Comment by Githook User [ 04/Dec/13 ]

Author:

{u'username': u'scotthernandez', u'name': u'Scott Hernandez', u'email': u'scotthernandez@gmail.com'}

Message: SERVER-11188, SERVER-11366, SERVER-11384, SERVER-11623: Update message cleanup
Branch: master
https://github.com/mongodb/mongo/commit/a523a77c9601d3d8c1bd6175ead83702b95409b9

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