Mongosh cuts output after pipe

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 1.6.2
    • Affects Version/s: None
    • Component/s: CLI Module
    • None
    • Environment:
      Mongodb:5.0.10 - 6.0.2
      Docker container
    • 5
    • Iteration Porpoise
    • Not Needed

      Problem Statement/Rationale

      Mongosh command cuts off the output when it's really long.

      Steps to Reproduce

      Install mongodb:5.0.10 - 6.0.2 and try to use following command on big collection:

      mongosh --quiet -host <host> -port <port> -u <username> -p <password> <dbname> --eval EJSON.stringify(db.<collectionName>.find().toArray(),null,2) | more
      

       

      Expected Results

      Print entire collection represented as Array and pass it to the "more" command, which helps you go through

      Actual Results

      Command output gets cut off, which makes JSON unserializable and incompatibile with standard JSON output format.

      Additional Notes

      When I found this bug i used python3.8.10 with subprocess library.
      Command that I used: 

      result = subprocess.Popen(<full_command>, stdout=PIPE)

      NOTE: stdout=PIPE works the same way as | operator, but enables you to store output in "result" variable

              Assignee:
              Anna Henningsen
              Reporter:
              Samson Kustra
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: