我的json文件包含以下内容:
laks@giis:/home/ubuntu# cat /tmp/db1.json
{ "_id" : { "$oid" : "54cf54e57f7cfa64c908ebd2" }, "tid" : 1, "__v" : 0 }
并正确导入:
laks@giis:/home/ubuntu# mongoimport -d test -c tutorials --file /tmp/db1.json
connected to: 127.0.0.1
Tue May 5 03:44:25.471 imported 1 objects
但是当我将日期字段添加到同一个db.json文件时,它失败了:
laks@giis:/home/ubuntu# cat /tmp/db1.json
{ "_id" : { "$oid" : "54cf54e57f7cfa64c908ebd2" }, "tid" : 1, "__v" : 0,"time" : { "$date" : "2015-02-01T22:09:31.475-0500" } }
laks@giis:/home/ubuntu# mongoimport -d test -c tutorials --file /tmp/db1.json
connected to: 127.0.0.1
Tue May 5 03:45:17.729 exception:BSON representation of supplied JSON is too large: code FailedToParse: FailedToParse: Date expecting integer milliseconds: offset:92
Tue May 5 03:45:17.729
Tue May 5 03:45:17.729 check 0 0
Tue May 5 03:45:17.729 imported 0 objects
Tue May 5 03:45:17.729 ERROR: encountered 1 error(s)
在cli中添加“--jsonArray”等其他解决方案并没有帮助。