Questions tagged «mongoimport»

21
如何使用mongoimport导入csv
尝试导入包含联系信息的CSV: Name,Address,City,State,ZIP Jane Doe,123 Main St,Whereverville,CA,90210 John Doe,555 Broadway Ave,New York,NY,10010 运行此命令似乎不会向数据库添加任何文档: $ mongoimport -d mydb -c things --type csv --file locations.csv --headerline Trace说imported 1 objects,但是启动Mongo shell并运行db.things.find()不会显示任何新文档。 我想念什么?

16
json文件的Mongoimport
我有一个包含约2000条记录的json文件。对应于mongo数据库中文档的每个记录的格式如下: {jobID:"2597401", account:"XXXXX", user:"YYYYY", pkgT:{"pgi/7.2-5":{libA:["libpgc.so"],flavor:["default"]}}, startEpoch:"1338497979", runTime:"1022", execType:"user:binary", exec:"/share/home/01482/XXXXX/appker/ranger/NPB3.3.1/NPB3.3-MPI/bin/ft.D.64", numNodes:"4", sha1:"5a79879235aa31b6a46e73b43879428e2a175db5", execEpoch:1336766742, execModify: new Date("Fri May 11 15:05:42 2012"), startTime: new Date("Thu May 31 15:59:39 2012"), numCores:"64", sizeT:{bss:"1881400168",text:"239574",data:"22504"}}, 每条记录都在JSON文件的一行中,并且只有换行符在每条记录的末尾。因此,文档中的每一行都以“ {jobID:”开头。。。我正在尝试使用以下命令将它们导入到mongo数据库中: mongoimport --db dbName --collection collectionName --file fileName.json 但是,出现以下错误: Sat Mar 2 01:26:12 Assertion: 10340:Failure parsing JSON string near: ,execModif 0x10059f12b …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.