Pretty print in MongoDB shell as default



  • 3 Answer(s)

    (Notice:The following answer should be a original version of the question, which did not have requirements for “default”)

    The below code will be usefull:

    db.collection.find().pretty()
    
    Answered on December 22, 2018.
    Add Comment

    Just you can try to add:

    DBQuery.prototype._prettyShell = true
    
    

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

    Answered on December 22, 2018.
    Add Comment

    (Notice: For the following answer to the updated question)

    Just can you do this on the CLI

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

    It always provide pretty results

    Answered on December 22, 2018.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.