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

BinData80 bin data type not parsed correctly by JSON to BSON parser

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Trivial - P5 Trivial - P5
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • ALL
    • Hide

      Add the following test to jsontests.cpp

      class BinData80 : public Base {
      virtual BSONObj bson() const

      { char z[ 3 ]; z[ 0 ] = 'a'; z[ 1 ] = 'b'; z[ 2 ] = 'c'; BSONObjBuilder b; b.appendBinData( "a", 3, bdtCustom, z ); return b.obj(); }

      virtual string json() const {
      return "{ \"a\" :

      { \"$binary\" : \"YWJj\", \"$type\" : \"80\" }

      }";
      }
      };

      and you get the error

      JsonTests::FromJsonTests::BinData80 std::exception: code FailedToParse: FailedToParse: Argument of $type in $bindata object must be a hex string representation of a single byte: offset:50 in test JsonTests::FromJsonTests::BinData80

      Show
      Add the following test to jsontests.cpp class BinData80 : public Base { virtual BSONObj bson() const { char z[ 3 ]; z[ 0 ] = 'a'; z[ 1 ] = 'b'; z[ 2 ] = 'c'; BSONObjBuilder b; b.appendBinData( "a", 3, bdtCustom, z ); return b.obj(); } virtual string json() const { return "{ \"a\" : { \"$binary\" : \"YWJj\", \"$type\" : \"80\" } }"; } }; and you get the error JsonTests::FromJsonTests::BinData80 std::exception: code FailedToParse: FailedToParse: Argument of $type in $bindata object must be a hex string representation of a single byte: offset:50 in test JsonTests::FromJsonTests::BinData80

          Assignee:
          sverch Shaun Verch
          Reporter:
          andrew.emil@10gen.com Andrew Emil (Inactive)
          Votes:
          0 Vote for this issue
          Watchers:
          1 Start watching this issue

            Created:
            Updated:
            Resolved: