mongo shell expects parens after `await`

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: 8.0.1
    • Component/s: None
    • None
    • DevProd Correctness
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      > ./mongodb-8.0/bin/mongo --eval 'Object.assign({}, await import("../mongosync/resmoke/jstests/libs/loader.js"))' --nodb
      MongoDB shell version v8.0.1-19-gfb3fcb0
      uncaught exception: SyntaxError: missing ) after argument list :
      @(shell eval):1:24
      exiting with code -4
      

      If I add parens after await, though, it works:

      > ./mongodb-8.0/bin/mongo --eval 'Object.assign({}, await(import("../mongosync/resmoke/jstests/libs/loader.js")))' --nodb
      MongoDB shell version v8.0.1-19-gfb3fcb0
      

      As best I can tell, await shouldn’t need parens.

      C2C needs mongo to test mongosync, and we have a nontrivial amount of our own JS tooling to support that testing. Inconsistencies like this complicate that tooling’s maintenance, so it’d be nice to see this fixed.

      Thank you!

            Assignee:
            Steve McClure
            Reporter:
            Felipe Gasper
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: