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

Piping into mongosh does not work

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 0.6.1
    • Affects Version/s: 0.5.0
    • Component/s: CLI Module
    • None
    • Environment:
      Test below is on x64 Ubuntu 18.04
    • Needed
    • Hide

      If we document how mongosh is being used from the command line, then piping a script into it could be documented as an officially supported way of running a script.

      Show
      If we document how mongosh is being used from the command line, then piping a script into it could be documented as an officially supported way of running a script.

      $ echo 'use admin;' | mongosh
      Current sessionID:  41153cf25761a2bd67fb1539
      Connecting to:      mongodb://127.0.0.1:27017
      Using MongoDB:      4.4.1
      Using Mongosh Beta: 0.5.0
      
      For more information about mongosh, please see our docs: https://docs.mongodb.com/mongodb-shell/
      
      > (node:20957) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 newListener listeners added to [Socket]. Use emitter.setMaxListeners() to increase limit
          at _addListener (events.js:402:17)
          at Socket.addListener (events.js:418:10)
          at Socket.Readable.on (internal/streams/readable.js:853:35)
          at LineByLineInput.on (/home/addaleax/src/mongosh/packages/cli-repl/lib/line-by-line-input.js:54:29)
          at EventEmitter.onData (readline.js:1161:14)
          at EventEmitter.emit (events.js:327:20)
          at EventEmitter.emit (domain.js:486:12)
          at LineByLineInput._emitChunk (/home/addaleax/src/mongosh/packages/cli-repl/lib/line-by-line-input.js:108:23)
          at LineByLineInput._emitChar (/home/addaleax/src/mongosh/packages/cli-repl/lib/line-by-line-input.js:105:14)
          at LineByLineInput._flush (/home/addaleax/src/mongosh/packages/cli-repl/lib/line-by-line-input.js:121:18)
      

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

              Created:
              Updated:
              Resolved: