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

MinKey/MaxKey serialization does not match legacy shell

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 1.1.4
    • Bson, Shell API
    • None
    • Not Needed
    • 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

              anna.henningsen@mongodb.com Anna Henningsen
              anna.henningsen@mongodb.com Anna Henningsen
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: