Pretty print in MongoDB shell as default

前端 未结 8 1753
予麋鹿
予麋鹿 2020-12-07 06:50

Is there a way to tell Mongo to pretty print output? Currently, everything is output to a single line and it\'s difficult to read, especially with nested arrays and document

相关标签:
8条回答
  • 2020-12-07 07:26

    You can add

    DBQuery.prototype._prettyShell = true
    

    to your file in $HOME/.mongorc.js to enable pretty print globally by default.

    0 讨论(0)
  • 2020-12-07 07:30

    (note: this is answer to the updated question)

    You can just do this on the CLI:

    echo DBQuery.prototype._prettyShell = true >> ~/.mongorc.js
    

    And it's always going to output pretty results.

    0 讨论(0)
提交回复
热议问题