-
Type: Question
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.2.8
-
Component/s: mongoimport
-
None
-
Environment:RHEL6.5
-
v2.6
Hello Mongo!!
while I use mongoimport to insert data , I found that some data's type have been changed automatically.
the string "0004" --changed to------> INT 4
questions:
1.is there some mechanism of mongodb cause this?
2.do we have some action plan to avoid this happen?
since my original data is a string,which represent someone's ID
the changes totally destory change our data
[mongo@mongos3 ~]$ cat MONGO.csv
"ID","DAY"
"0004","2016-08-24 10:55:44"
"1004","2016-08-24 11:50:28"
MongoDB Enterprise mongos> db.mongo.find().forEach(function{if({"ID":{$type:16}}){count++}});
print(count);
MongoDB Enterprise mongos> print(count);
2
MongoDB Enterprise mongos> db.mongo.find().pretty()
{ "_id" : ObjectId("57bd4687ff3116d554692267"), "ID" : 4, "DAY" : "2016-08-24 10:55:44" } { "_id" : ObjectId("57bd4687ff3116d554692268"), "ID" : 1004, "DAY" : "2016-08-24 11:50:28" }- duplicates
-
TOOLS-67 Give mongoimport of CSV/TSVs a way to specify import types
- Closed