MongoDB Compass中的JSON输入意外结束 [英] Unexpected end of JSON input in MongoDB Compass
本文介绍了MongoDB Compass中的JSON输入意外结束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在MongoDB指南针中导入json类型的数据, 导入功能给出此错误 "json输入意外结束"
I want to import data of type json in MongoDB compass, the import function gives this error " unexpected end of json input "
有一些我的json文件
there is a some of my json file
[
{
'id' :4,
'user' : 'test@example.com',
'date1' :'2019-03-01',
'date2' : '2019-04-01',
'statut' : 'Good',
'guest_number' : 4
}
]
推荐答案
解决方案是将所有JSON写在一行中,但是如果我们有大量文档! 我刚刚找到了一种解决方案,可以在终端中使用此命令导入数据:
the solution is to write all JSON in one line, but if we have a big doc !! I just found a solution that I can import data with this command in terminal :
mongoimport --jsonArray --db YourDatabase --collection YourCollection --file Yourfile.json
这篇关于MongoDB Compass中的JSON输入意外结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文