search

Home  >  Q&A  >  body text

shell - MongoDB命令行下是否有格式化find()返回结果的方法

使用 db.collection.find() 返回数据,每一条占一整行,一点格式都没有,好难阅读,不知道有没有方法格式化返回的值,比如每个key-value占一行这种的

阿神阿神2801 days ago661

reply all(3)I'll reply

  • 天蓬老师

    天蓬老师2017-04-21 10:58:18

    db.collection.find().pretty();

    reply
    0
  • 迷茫

    迷茫2017-04-21 10:58:18

    Add a once and for all method, execute the following code in the shell

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

    This way you will be pretty() anytime and anywhere

    reply
    0
  • 迷茫

    迷茫2017-04-21 10:58:18

    The method upstairs is good

    reply
    0
  • Cancelreply