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

Support multiple --eval arguments

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.5.1
    • Affects Version/s: None
    • Component/s: CLI Module
    • None
    • 2
    • Iteration Cuttlefish, Iteration Dolphin
    • Needed
    • Hide

      mongosh will now accept --eval multiple times, e.g.

      mongosh --quiet --eval 'use mydb' --eval 'show collections' mongodb://localhost/

      would work now. The scripts are evaluated as if they were input to the shell, and can share variables etc.; only the result of the last --eval script is printed.

      Show
      mongosh will now accept --eval multiple times, e.g. mongosh --quiet --eval 'use mydb' --eval 'show collections' mongodb://localhost/ would work now. The scripts are evaluated as if they were input to the shell, and can share variables etc.; only the result of the last --eval script is printed.

      There is no reason why mongosh wouldn't be able to support multiple --eval arguments on the command line, and doing so allows easily running shell-like commands like use, show, snippet etc. in the syntaxes that users are familiar with.

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

              Created:
              Updated:
              Resolved: