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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical - P2
    • Resolution: Fixed
    • 2.4.0-rc0
    • 2.4.0-rc1
    • Shell
    • 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.

    Description

      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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: