[SERVER-2634] mongoimport fails to import CSV when field value is a full stop "." Created: 28/Feb/11  Updated: 12/Jul/16  Resolved: 01/Jul/11

Status: Closed
Project: Core Server
Component/s: Tools
Affects Version/s: 1.6.5
Fix Version/s: 1.9.1

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

Issue Links:
Related
is related to SERVER-1097 mongoimport / export should adhere to... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

I am having a problem using mongoimport when the data value is a full stop.
It appears the full stop "." is translated to 0 during the insert

Example file
"name","value"
"Hello","."

Import command
mongoimport --db test --collection dottest --type csv --headerline --file world.csv

Result on MongoDB
> db.dottest.find();

{ "_id" : ObjectId("4d67d6cb4e6aea4032d2230e"), "name" : "Hello", "value" : 0, "field2" : "e\"" }

It seems like the "." is being treated as two fields, the first having value 0 and the second "e\""

I don't have this problem if I insert from a Mongo session
db.dottest.save(

{"name":"Hello","value":"."}

);
works fine

Or if I use mongoimport and the full stop appears with other text "Hello","Mr." will load fine



 Comments   
Comment by auto [ 01/Jul/11 ]

Author:

{u'login': u'stbrody', u'name': u'Spencer T Brody', u'email': u'spencer@10gen.com'}

Message: SERVER-2634: mongoimport imports the string "." as the number 0
Branch: master
https://github.com/mongodb/mongo/commit/e27fa36b4c47b277b6e140f641a1187b712d99ca

Generated at Thu Feb 08 03:00:44 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.