mongoimport 2.6与2.4 [英] mongoimport 2.6 vs 2.4
问题描述
我正在从一个数据库导出数据,并将数据导入另一个数据库.当我将数据导出到具有mongo 2.6的计算机上时,但是当我将数据导入到使用mongo 2.4的VM上时.两个mongod实例都运行2.4.
I am exporting data from one database and importing data to another database. When I export the data its on a machine with mongo 2.6 but when I import the data its on a VM using mongo 2.4. Both mongod instances are running 2.4.
我不断收到此错误:
Wed Jun 4 13:13:32.604 check 0 0
Wed Jun 4 13:13:32.604 imported 0 objects
Wed Jun 4 13:13:32.604 ERROR: encountered 1 error(s)
failed: [192.168.140.30] => (item=collection) => {"changed": true, "cmd": "mongoimport -u username -p password -d db -c collection --drop --jsonArray /tmp/collection.json ", "delta": "0:00:00.026383", "end": "2014-06-04 13:13:33.091774", "item": "collection", "rc": 255, "start": "2014-06-04 13:13:33.065391"}
stdout: connected to: 127.0.0.1
Wed Jun 4 13:13:33.089 dropping: <db.collection>
Wed Jun 4 13:13:33.089 exception:BSON representation of supplied JSON array is too large: code FailedToParse: FailedToParse: Date expecting integer milliseconds: offset:171
导出的日期格式类似于
{ "date" : { "$date" : "2014-06-02T06:39:28.869-0700" }
我已经验证了在与mongoexport相同的机器上使用mongoimport可以正常工作,因此我认为mongoimport/export从2.4到2.6之间存在兼容性问题.由于防火墙的限制,我需要使用两台不同的计算机来移动数据.
I have verified that using mongoimport on the same machine as the mongoexport works fine, so I assume there is a compatablility issue between mongoimport/export from 2.4 to 2.6. Due to firewall restrictions I need to use the two different machines for moving the data around.
有人可以解决此问题吗?据我所知,我还没有看到以旧格式导出的选项.我也无法从发行说明中得知是什么导致了兼容性错误.
Does anybody have any good work arounds for this problem. I have not seen an option to export in the old format as far as I can tell. I also cannot tell from the release notes, what is causing the compatability error.
推荐答案
我最终使用mongodump和mongorestore代替了mongoimport和mongo导出.使用bson文档而不是json时没有兼容性问题.
I ended up using mongodump and mongorestore instead of mongoimport and mongo export. There was no compatability issue using bson documents instead of json.
这篇关于mongoimport 2.6与2.4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!