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

Array destructuring should not be desugared

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.2.1
    • Affects Version/s: 1.1.5
    • Component/s: AsyncWriter
    • None
    • 5
    • Not Needed
    • Iteration Versailles, Iteration Wolverhampton, Iteration Xochimilco

      In mongosh, we desugar objects and arrays destructuring, which might create issues for example when a function is used as the body of a $function expression in an aggregation.

      For example, (function(foo) {const [a, b] = foo.split();}).toString()

      becomes:

      function (foo) { const _foo$split = foo.split(), _foo$split2 = _slicedToArray(_foo$split, 2), a = _foo$split2[0], b = _foo$split2[1]; }
      

       

      and _sliceToArray does not exist on the server and breaks the pipeline.

            Assignee:
            anna.henningsen@mongodb.com Anna Henningsen
            Reporter:
            massimiliano.marcon@mongodb.com Massimiliano Marcon
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: