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

Server logging of BSON containing BinData does not roundtrip

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 5.1.0-rc0
    • None
    • None
    • Fully Compatible
    • ALL
    • Security 2021-07-26

    Description

      When the server logs a bson object containing BinData (at least of type 0 such as the lsid.uid field), the hex encoded value is not quoted:

      { 
        lsid: { 
          id: UUID("445f7935-6df6-492e-b078-00e030e4ffea"), 
          uid: BinData(0, E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855)
        }
      }
      

      That (extended) json cannot be fed back into the shell.

      For comparison, the shell does output the BinData with quotes:

      config> db.system.sessions.find().pretty()
      {
      	"_id" : {
      		"id" : UUID("eef34f2c-612f-475d-846b-67b221f0081c"),
      		"uid" : BinData(0,"47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=")
      	},
      	"lastUse" : ISODate("2021-04-29T14:24:06.339Z")
      }
      

      I also expect that outputting hex encoded BinData instead of base64 encoded BinData would also be a problem for round tripping with the shell? Maybe this was an intentional decision and not an oversight, but it's certainly useful for development to be able to paste the server output into a the javascript mongo shell.

      Attachments

        Activity

          People

            mark.benvenuto@mongodb.com Mark Benvenuto
            daniel.gottlieb@mongodb.com Daniel Gottlieb (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: