Print BSON JS objects in full depth

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • vNext
    • Affects Version/s: None
    • Component/s: None
    • 8
    • Iteration Fortitudo, Iteration Milky Way, Iteration Neptune, Iteration Ozone, Iteration Planetarium, Iteration X-Ray
    • Needed
    • Hide

      mongosh now prints documents coming from the server, such as the response to `collection.find()` or `collection.findOne()`, in full depth by default, with no string or array length limitations.

      There is a new `-deepInspect[=true|false]` CLI flag that can be set to control this behavior, since it has performance implications. By default, this flag is set to "off" in programmatic mode (when using `eval` or `file` without `shell`), and only the final result of `-eval` is printed in full depth. In non-programmatic/REPL mode, it is set to "on" by default.

      Show
      mongosh now prints documents coming from the server, such as the response to `collection.find()` or `collection.findOne()`, in full depth by default, with no string or array length limitations. There is a new `- deepInspect [=true|false] ` CLI flag that can be set to control this behavior, since it has performance implications. By default, this flag is set to "off" in programmatic mode (when using ` eval` or ` file` without ` shell`), and only the final result of ` -eval` is printed in full depth. In non-programmatic/REPL mode, it is set to "on" by default.

      Some MongoSh users seemed unaware of the output truncation when printing objects and got confused by the absence of expected output when running commands.

      We may want to guide users to a solution in these situations.

      See: https://mongodb.slack.com/archives/CUHC9R8J0/p1655926484918129

      In the thread, it has been proposed to print a warning when the first truncation occurs in a session and to direct users toward the inspectDepth configuration.

      CC: christopher.harris@mongodb.com

            Assignee:
            Le Roux Bodenstein
            Reporter:
            Maurizio Casimirri
            Votes:
            1 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: