mongodb插入数据报错:malformed UTF-8 character sequence at offset

执行的脚本如下:

 db.col.insert({ "_id" : ObjectId("56066542ade2f21f36b0313a"), "title" : "PHP 教程", "description" : "PHP 是一种创建动态交互性站点的强有力的服务器端脚本语言。", "by" : "PHP  教程", "url" : "http://www.runoob.com", "tags" : [ "php" ], "likes" : 200 })


问题原因:插入的数据中存在字符编码问题,

改成如下格式即可:

 db.col.insert({ "_id" : ObjectId("56066542ade2f21f36b0313a"), "title" : "PHP 教程", "description" : "PHP  ", "by" : "PHP  教程", "url" : "http://www.runoob.com", "tags" : [ "php" ], "likes" : 200 })





你可能感兴趣的:(MongoDB)