-
Type:
Task
-
Resolution: Works as Designed
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
mongoimport 4.2 is reporting an error while importing a JSON file.
5000 documents are imported instead of the expected 67000.
$ mongoimport --drop -d sample -c routes --verbose=4 routes.json 2019-08-20T09:50:33.337-0700 using write concern: &{majority false 0} 2019-08-20T09:50:33.337-0700 using 8 decoding workers 2019-08-20T09:50:33.337-0700 using 1 insert workers 2019-08-20T09:50:33.337-0700 will listen for SIGTERM, SIGINT, and SIGKILL 2019-08-20T09:50:33.399-0700 filesize: 13321173 bytes 2019-08-20T09:50:33.399-0700 using fields: 2019-08-20T09:50:33.399-0700 connected to: mongodb://localhost/ 2019-08-20T09:50:33.399-0700 ns: sample.routes 2019-08-20T09:50:33.400-0700 connected to node type: replset 2019-08-20T09:50:33.400-0700 dropping: sample.routes 2019-08-20T09:50:33.777-0700 Failed: invalid JSON input. Position: 151. Character: N 2019-08-20T09:50:33.777-0700 5000 document(s) imported successfully. 0 document(s) failed to import.
The same command works well
- when called with --legacy
- in version 4.0
Here are the lines 4999-5001:
{"_id":{"$oid":"56e9b39b732b6122f8780efc"},"airline":{"id":24,"name":"American Airlines","alias":"AA","iata":"AAL"},"src_airport":"DFW","dst_airport":"SNA","codeshare":"","stops":0,"airplane":738} {"_id":{"$oid":"56e9b39b732b6122f8780efd"},"airline":{"id":24,"name":"American Airlines","alias":"AA","iata":"AAL"},"src_airport":"DFW","dst_airport":"SPI","codeshare":"Y","stops":0,"airplane":"ERD ER4"} {"_id":{"$oid":"56e9b39b732b6122f87806ad"},"airline":{"id":3432,"name":"Maxair","alias":"8M","iata":"MXL"},"src_airport":"CAN","dst_airport":"RGN","codeshare":"","stops":0,"airplane":320}
The only use of extended JSON is "$oid", which seems valid for V1 and V2.
The version is:
$ mongoimport --version mongoimport version: r4.2.0 git version: a4b751dcf51dd249c5865812b390cfd1c0129c30 Go version: go1.12.4 os: darwin arch: amd64 compiler: gc
The complete JSON file is available here:
https://github.com/10gen/training/blob/master/usb_drive/routes.json