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

Expose and document `printjson` as `printfull`, add `printejson`

    • Type: Icon: New Feature New Feature
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Shell API
    • 2

      MONGOSH-955 highlighted that users have a need for using more complex value formatting needs than what print can deliver out of the box, and adding custom specifiers to console.dir() for example can quickly become unwieldy for human users.

      As a workaround, I suggest:

      • Rename printjson (which is kept as an alias) to printfull, for printing an object in its unabridged form. Document printfull as a public API.
      • Add printejson(value[, options]) as a shorthand for print(EJSON.stringify(value, null, options ?? 2)) in order to make it easier to get actual JSON output.

            Unassigned Unassigned
            anna.henningsen@mongodb.com Anna Henningsen
            1 Vote for this issue
            3 Start watching this issue