Mongodb import error

放肆的年华 提交于 2019-12-24 01:54:35

问题


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.

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

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?


回答1:


Here I am answering my own question again, hopefully it helps someone else.

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.

As a footnote, I initially loaded my MongoDB using Mongoid from Ruby which was apparently able to handle those pre 1970 dates.



来源:https://stackoverflow.com/questions/14468136/mongodb-import-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!