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.

I keep getting this error:

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

And the exported date format looks like

{ "date" : { "$date" : "2014-06-02T06:39:28.869-0700" }

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.

tkinz27
  • 111
  • 1
  • 9
  • similar: http://stackoverflow.com/questions/5761053/is-there-a-way-to-run-mongodb-shell-or-tojson-method-in-strict-json-mode, also see http://docs.mongodb.org/manual/reference/mongodb-extended-json/#date – zamnuts Jun 04 '14 at 20:36
  • give it a look to: http://stackoverflow.com/questions/14758605/mongoexport-using-gt-and-lt-constraints-on-a-date-range – Francisco López-Sancho Nov 03 '14 at 10:09

1 Answers1

3

I ended up using mongodump and mongorestore instead of mongoimport and mongo export. There was no compatability issue using bson documents instead of json.

tkinz27
  • 111
  • 1
  • 9