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

update $bit error messages are unclear

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.5.5
    • Affects Version/s: 2.5.3
    • Component/s: Write Ops
    • Labels:

      > 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?

            Assignee:
            scotthernandez Scott Hernandez (Inactive)
            Reporter:
            amalia.hawkins@10gen.com Amalia Hawkins
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: