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

BinData constructor for V8 stores binary data as UTF-8, mangling it

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • 2.4.0-rc1
    • Affects Version/s: 2.4.0-rc0
    • Component/s: Shell
    • Environment:
      Windows
    • Fully Compatible
    • ALL
    • Hide

      Execute shell script with 2.2 running:

      dev:PRIMARY> var o = db.Order.findOne()
      dev:PRIMARY> var id = o._id
      dev:PRIMARY> id
      BinData(3,"xLJbbLwhA0qZSzdGaK4l7g==")
      dev:PRIMARY> id.toCSUUID()
      CSUUID("6c5bb2c4-21bc-4a03-994b-374668ae25ee")
      dev:PRIMARY> db.Order.findOne({_id:id},{_id:1})

      { "_id" : BinData(3,"xLJbbLwhA0qZSzdGaK4l7g==") }

      dev:PRIMARY>

      CSUUID matches the GUID that C# and MongoVue see.

      Starting 2.4-rc0 (with the same data files) produces:

      dev:PRIMARY> var o = db.Order.findOne()
      dev:PRIMARY> var id = o._id
      dev:PRIMARY> id
      BinData(3,"xLJbbO+/vSEDSu+/vUs3Rg==")
      dev:PRIMARY> id.toCSUUID()
      CSUUID("6c5bb2c4-bfef-21bd-034a-efbfbd4b3746")
      dev:PRIMARY> db.Order.findOne({_id:id},{_id:1})
      null
      dev:PRIMARY>

      NOTE: Different CSUUID and inability to find record with the _id of the record just read.

      Have tried repair / rebuild index.

      Show
      Execute shell script with 2.2 running: dev:PRIMARY> var o = db.Order.findOne() dev:PRIMARY> var id = o._id dev:PRIMARY> id BinData(3,"xLJbbLwhA0qZSzdGaK4l7g==") dev:PRIMARY> id.toCSUUID() CSUUID("6c5bb2c4-21bc-4a03-994b-374668ae25ee") dev:PRIMARY> db.Order.findOne({_id:id},{_id:1}) { "_id" : BinData(3,"xLJbbLwhA0qZSzdGaK4l7g==") } dev:PRIMARY> CSUUID matches the GUID that C# and MongoVue see. Starting 2.4-rc0 (with the same data files) produces: dev:PRIMARY> var o = db.Order.findOne() dev:PRIMARY> var id = o._id dev:PRIMARY> id BinData(3,"xLJbbO+/vSEDSu+/vUs3Rg==") dev:PRIMARY> id.toCSUUID() CSUUID("6c5bb2c4-bfef-21bd-034a-efbfbd4b3746") dev:PRIMARY> db.Order.findOne({_id:id},{_id:1}) null dev:PRIMARY> NOTE: Different CSUUID and inability to find record with the _id of the record just read. Have tried repair / rebuild index.

      Trying to iterate a collection in the shell and perform updates on each item fails. Turns out that Mongo cannot find the item it has just read (by its _id).

      This is using CSGUIDs and it appears that the byte order of the BinData read is being changed within the shell. The application and other tools can still read and report the values correctly so it is most likely a problem with the shell rather than the server itself.

            Assignee:
            tad Tad Marshall
            Reporter:
            simon@captaincodeman.com Simon Green
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: