Mongodb导入错误 [英] Mongodb import error
问题描述
使用转储/还原将MongoDB数据库从本地计算机移至MongoHQ.com时遇到问题.当我将转储恢复到MongoHQ时,它丢失了大约10%的文档,没有明显的错误.
I'm ran into a problem using dump/restore to move a MongoDB database from my local machine to the MongoHQ.com. When I restore the dump to MongoHQ it is missing about 10% of the documents with no apparent errors.
要进行故障排除,尽管我将在本地使用导出/导入来验证数据,但导入时遇到错误,但导出未报告任何错误.我使用json格式进行导出.这是导入错误之一;
To troubleshoot I though I would use export/import locally to validate the data and I am getting a error on import, the export did not report any errors. I used json format for the export. Here is one of the import errors;
exception:BSON representation of supplied JSON is too large: code FailedToParse: FailedToParse: Date milliseconds overflow: offset:10357
它报告约130k中的726个文档中的错误.基于该错误,我认为日期字段存在问题,但是我无法弄清楚如何找到问题文档.我试过运气不好.
任何人都有一个想法来尝试找出问题所在吗?
It reports errors on 726 documents out of about 130k. Based on the error I think it is having problems with a date field but I cant figure out how to find the problem documents. I tried doing a repair with no luck.
Anyone have an idea to try to find what's wrong?
推荐答案
在这里,我再次回答自己的问题,希望对您有所帮助.
Here I am answering my own question again, hopefully it helps someone else.
该问题发生在日期为1970年1月1日(Unix时期)之前的任何文档中.我假设转储/恢复可以正常处理,但不能导出/导入,因为转储/恢复使用BSON,而导入/导出使用JSON或CSV.这是针对MongoDB的未解决的错误报告 https://jira.mongodb.org/browse/SERVER-961 .
The problem occurs on any document with dates before Jan 1 1970, the Unix epoch. I am assuming that dump/restore handles it okay but not export/import because dump/restore is using BSON and import/export uses JSON or CSV. This is an unresolved bug report for MongoDB https://jira.mongodb.org/browse/SERVER-961.
作为一个脚注,我最初使用Ruby的Mongoid加载了MongoDB,它显然能够处理那些1970年以前的日期.
As a footnote, I initially loaded my MongoDB using Mongoid from Ruby which was apparently able to handle those pre 1970 dates.
这篇关于Mongodb导入错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!