Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1024

MinKey/MaxKey serialization does not match legacy shell

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.1.4
    • Component/s: Bson, Shell API
    • Labels:
      None
    • Documentation Changes:
      Not Needed
    • Sprint:
      Iteration Phnom Penh

      Description

      In the legacy shell, MinKey and MinKey() are treated the same when sent over the wire. This is convenient for users, but not something we can easily emulate in mongosh, where MinKey is treated like any other function, and serialized as a function when sent over. This can be an issue e.g. when used as a sharding split key.

      I don’t think we can address this in mongosh itself. Our options would be:

      • Doing nothing and documenting the current state
      • Asking the Node.js driver to check for typeof value === 'function' after checking the BSON type against MaxKey/MinKey instead of before, then modifying our MinKey/MaxKey shell builtins to have ._bsontype properties
      • Asking the Node.js driver to emulate the legacy shell’s behaviour, i.e. treat the MinKey class like the MinKey() value itself when serialized as BSON

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              anna.henningsen Anna Henningsen
              Reporter:
              anna.henningsen Anna Henningsen
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: