findOne()生成漂亮的json对象。find()导致jarbled json对象。在mongo shell中显示时,如何使find()与findOne()相同? 最佳答案 如果您使用JavaScript编写脚本,则可以使用dcrosta的答案。但是,如果您想直接在mongo交互式shell上进行 pretty-print ,则必须将pretty()附加到find()查询中。在 shell 上输入:db.yourcollection.find().pretty()