Mongosh command cuts off the output when it's really long.
Install mongodb:5.0.10 - 6.0.2 and try to use following command on big collection:
Print entire collection represented as Array and pass it to the "more" command, which helps you go through
Command output gets cut off, which makes JSON unserializable and incompatibile with standard JSON output format.
When I found this bug i used python3.8.10 with subprocess library.
Command that I used:
NOTE: stdout=PIPE works the same way as | operator, but enables you to store output in "result" variable