suchen

Heim  >  Fragen und Antworten  >  Hauptteil

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

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

阿神阿神2854 Tage vor672

Antworte allen(3)Ich werde antworten

  • 天蓬老师

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

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

    Antwort
    0
  • 迷茫

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

    补充个一劳永逸的方法,在 shell 里执行下列代码

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

    这样随时随地都是 pretty() 了

    Antwort
    0
  • 迷茫

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

    楼上的方法好

    Antwort
    0
  • StornierenAntwort