[SERVER-2971] mongoimport + oversize numbers => garbage field Created: 20/Apr/11  Updated: 12/Jul/16  Resolved: 04/Oct/11

Status: Closed
Project: Core Server
Component/s: Tools
Affects Version/s: 1.8.1
Fix Version/s: 2.0.0

Type: Bug Priority: Minor - P4
Reporter: Gaetan Voyer-Perrault Assignee: Spencer Brody (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows


Attachments: Microsoft Word gg.csv    
Operating System: Windows
Participants:

 Description   

Summary
======

  • mongoimport is creating an extra field (field5) in cases where the last field is numeric AND has more than 15 digits.
  • mongoimport does not have this problem if the over-sized field is before the last "column"

Reproduce
======
Run the following on the attached CSV:
mongoimport -d dealerlocator -c dealers --type csv --fields "_id,name,address,latitude,longitude" --drop --file gg.csv

From the attached file, the last document looks like this:
{
"_id" : 52373,
"name" : "GARAGE DU VAL D'ARGENT",
"address" : "1C R MAURICE BURRUS 68160 STE CROIX AUX MINES",
"latitude" : 48.257771809895836,
"longitude" : 7.212600199381513,
"field5" : "333333333\""
}

In the file

  • latitude : "48.2577718098958333333333333333333333333"
  • longitude : "7.21260019938151333333"

Problem
------
Latitude was correctly trimmed into a numeric.
Longitude was incorrectly "cut".



 Comments   
Comment by Frédéric Cons [ 28/Sep/11 ]

Hi
I imported the attached file with mongoimport v2 on a 1.8.1 running instance, and the result looks fine
Thanks
Fred

Comment by Spencer Brody (Inactive) [ 27/Sep/11 ]

Can you please try this again using mongoimport from 2.0? The CSV handling functionality of mongoimport was completely rewritten in 2.0 and it is likely this bug was fixed in that process. It is fine to run mongoimport from 2.0 against a 1.8 server.

Comment by Frédéric Cons [ 21/Apr/11 ]

Please note that I also had this problem when using numbers with 15 digits
Using

52351,"GARAGE DE LA TUILERIE","18 RTE DE BEAUVAIS 95810 EPIAIS RHUS","49.121577962239","2.0502000172932"
49735,"SNAT","95 R DU TILLEUL 59200 TOURCOING","50.719580078125","3.1692100524902"

gave me :

> db.dealers.find()

{ "_id" : 52351, "name" : "GARAGE DE LA TUILERIE", "address" : "18 RTE DE BEAUVAIS 95810 EPIAIS RHUS", "lat" : 49.121577962239, "long" : 2.0502000172932 } { "_id" : 49735, "name" : "SNAT", "address" : "95 R DU TILLEUL 59200 TOURCOING", "lat" : 50.719580078125, "long" : 3.1692100524902, "field5" : "39\"", "field6" : 2.0502000172932 }
Generated at Thu Feb 08 03:01:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.