【发布时间】:2017-01-26 23:56:03
【问题描述】:
一种以格式化方式显示结果的方法是 pretty() 方法。但是,我有 方法 pretty() 出现以下错误
db.mycol.find().pretty()
{
... "title":"MongoDB 不是 sql 数据库",
... "by":"教程点",
... "url":"http://www.tutorilaspoint.com",
...“标签”:[“mongodb”,“数据库”,“NoSQL”],
...“喜欢”:“100”
... }
2016-09-19T16:31:34.779+0545 SyntaxError: Unexpected token :
【问题讨论】:
-
提供您的代码
-
它与教程点的代码相同 >db.mycol.find().pretty() { "_id": ObjectId(7df78ad8902c), "title": "MongoDB Overview", "description": " MongoDB是没有sql数据库", "by": "教程点", "url": "tutorialspoint.com", "tags": ["mongodb", "database", "NoSQL"], "likes": "100 " } >
-
应该是
pretty()而不是preety() -
db.mycol.find().pretty() > { ... "title":"MongoDB is no sql database", ... "by":"tutorials point", .. . "url":"tutorilaspoint.com", ... "tags":["mongodb","dtabase","NoSQL"], ... "likes":"100" ... } 2016-09- 19T16:31:34.779+0545 SyntaxError: 意外令牌:
标签: mongodb