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

MinKey/MaxKey serialization does not match legacy shell

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.1.4
    • Affects Version/s: None
    • Component/s: Bson, Shell API
    • None
    • Not Needed
    • Iteration Phnom Penh

      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

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

              Created:
              Updated:
              Resolved: