将JSON加载到Mongodb

时间:2014-05-12 19:36:07

标签: json mongodb import mongoimport

我正在尝试使用以下命令将80 meg JSON文件加载到mongodb中:

mongoimport --db qt --collection cftable --type json --file cftable.json --jsonArray

我从mongoimport得到的是以下内容:

2014-05-12T14:16:00.338-0500 check 0 0 2014-05-12T14:16:00.338-0500 imported 0 objects encountered 1 error(s)

以下是样本记录的样子 - 其中大约有65,000个。无接近16毫克。整个文件是80 MB。有没有办法让我能够以一种允许我缩小问题的方式来打破导入?或者我用mongoimport咆哮错误的树来做这样的事情?

[ { "last_name": "Jones", "first_name": "Johny", "middle_name": "J.", "nick_name": "", "gen_qual": "", "degree": "Ph.D.", "specialty": "LabM & Path", "voting_staff_flag": "1", "start_date": "Jan 1 1900 12:00:00:000AM", "end_date": "Dec 31 2599 11:59:00:000PM", "time_code": "All Day", "resident_or_fellow_flag": "0", "smtp_address": "Jones.Johny@mayo.edu", "per_id": "12345678", "rank": "Cons", "committee_member": "Y", "point_entity": "Somewhere", "s_last_name": "JONES", "s_first_name": "JOHNY", "ALT_IDENTIFIER_1": "JONESJ", "ALT_IDENTIFIER_2": "MRE2222", "ALT_IDENTIFIER_3": "SO_ST_02_50-EP", "ALT_IDENTIFIER_4": "123456", "campus_name": "Somewhere, Ohio", "work_locations": [ { "w_ai": 17395220, "work_location_sort": 15, "building": "Rexell Building", "floor": "2", "area": "Experimental Pathology", "pager": "111 or (11)5-5555", "phone": "(11)9-9999", "supports": [ { "support_sort": 0, "support_desc": " ", "support_note": " ", "support_phone": " ", "support_start_date": "", "support_end_date": "" } ] }, { "w_ai": 174956, "work_location_sort": 25, "building": "Rexell Building", "floor": "2", "area": "Laboratory", "pager": "111 or (11)1-1111", "phone": "(11)2-2222", "supports": [ { "support_sort": 15, "support_desc": "Medical Secretary", "support_note": " ", "support_phone": "(11)6-6666", "support_start_date": "Jan 1 1900 12:00:00:000AM", "support_end_date": "Dec 31 2599 12:00:00:000AM" } ] } ] } ''' ]

1 个答案:

答案 0 :(得分:0)

我会将您的记录插入MongoDB,执行mongoexport - 并将该文件与您的文件进行比较。