mongodb的find().pretty()方法
直接上代码对比:
db.site.find()
{ "_id" : ObjectId("60c0571c63d75d53b0798add"), "name" : "菜鸟教程", "url" : "www.runoob" }
{ "_id" : ObjectId("60c058783b7a325bd8e810fe"), "name" : "菜鸟工具", "url" : "https://c.runoob.com", "type" : "cn" }
{ "_id" : ObjectId("60c058783b7a325bd8e810ff"), "name" : "Google", "url" : "https://www.google.com", "type" : "en" }
{ "_id" : ObjectId("60c058783b7a325bd8e81100"), "name" : "Facebook", "url" : "https://www.google.com", "type" : "en" }
db.site.find().pretty()
{
"_id" : ObjectId("60c0571c63d75d53b0798add"),
"name" : "菜鸟教程",
"url" : "https://www.runoob.com"
}
{
"_id" : ObjectId("60c058783b7a325bd8e810fe"),
"name" : "菜鸟工具",
"url" : "https://c.runoob.com",
"type" : "cn"
}
{
"_id" : ObjectId("60c058783b7a325bd8e810ff"),
"name" : "Google",
"url" : "https://www.google.com",
"type" : "en"
}
{
"_id" : ObjectId("60c058783b7a325bd8e81100"),
"name" : "Facebook",
"url" : "https://www.google.com",
"type" : "en"
}
使得查询出来的数据在命令行中更加美观的显示,不至于太紧凑。