Uploaded image for project: 'MongoDB Command Line Tools'
  1. MongoDB Command Line Tools
  2. TOOLS-1410

data && datatype have benn changed by mongoimport

    XMLWordPrintable

    Details

    • Type: Question
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 3.2.8
    • Fix Version/s: None
    • Component/s: mongoimport
    • Labels:
      None
    • Environment:
      RHEL6.5
    • Backport Requested:
      v2.6

      Description

      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" }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                gabriel.russell Gabriel Russell
                Reporter:
                supersujj sujia jun
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: