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

The mongo shell needs better support for displaying and entering GUIDs/UUIDs

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 1.9.0
    • Component/s: Shell
    • Labels:
      None

      Working with GUIDs in the mongo shell is painful. We need a better way to enter them. One suggestion, a factory method on BinData:

      > BinData.fromGuid("b4ebe978-bf69-489c-9d3e-bc6839d6de25")
      BinData(3,"tOvpeL9pSJydPrxoOdbeJQ==")
      >

      Or some other usable alternative. The shell should also use the same notation on output so that it is more readable.

      One final problem: all existing C# drivers have been writing GUIDs in a binary representation where the first three fields of the GUID are little endian (because that's what Guid.ToByteArray happens to return), whereas all other drivers are using the more sensible big endian representation. So depending on which driver stored the GUID the string representation would be different. This is a really difficult problem to solve without backward compatibility problems. The shell is affected because it needs to know what byte order to use when converting the string representation of a GUID to an instance of BinData.

        1. uuidhelpers.js
          7 kB
          Robert Stam

            Assignee:
            geert.bosch@mongodb.com Geert Bosch
            Reporter:
            robert@mongodb.com Robert Stam
            Votes:
            16 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: