-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: CLI Module
-
None
-
Environment:Mongodb:5.0.10 - 6.0.2
Docker container
-
5
-
Not Needed
-
Iteration Porpoise
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