Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-1998

mongoimport --mode merge --typ csv --collection not working

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.4.0, 3.4.5, 3.6.3
    • Component/s: mongoimport
    • Environment:
      Mac OS

      Trying to import the following csv:

      _id,receiver,month,accrualMonth,paymentData.bankCode,operation
      573378aef3af68090023da7d,547517955021020200599440,2016-05,2016-04,41,Manual
      

      When I run in mongo shell mongo version 3.4.5

      mongoimport --db mean-dev --mode=merge --collection fulfilledpayments  --type csv --headerline --file ~/Downloads/\Import.csv -vvvv
      

      it returns the following log but it doesn't really import:

      2018-04-04T20:51:25.331-0300	using upsert fields: [_id]
      2018-04-04T20:51:25.332-0300	using 0 decoding workers
      2018-04-04T20:51:25.332-0300	using 1 insert workers
      2018-04-04T20:51:25.332-0300	will listen for SIGTERM, SIGINT, and SIGKILL
      2018-04-04T20:51:25.360-0300	filesize: 139 bytes
      2018-04-04T20:51:25.361-0300	using fields: _id,receiver,month,accrualMonth,paymentData.bankCode,operation
      2018-04-04T20:51:25.381-0300	connected to: localhost
      2018-04-04T20:51:25.381-0300	ns: mean-dev.fulfilledpayments
      2018-04-04T20:51:25.381-0300	connected to node type: standalone
      2018-04-04T20:51:25.381-0300	standalone server: setting write concern w to 1
      2018-04-04T20:51:25.381-0300	using write concern: w='1', j=false, fsync=false, wtimeout=0
      2018-04-04T20:51:25.381-0300	standalone server: setting write concern w to 1
      2018-04-04T20:51:25.381-0300	using write concern: w='1', j=false, fsync=false, wtimeout=0
      2018-04-04T20:51:25.382-0300	got line: [573378aef3af68090023da7d 547517955021020200599440 2016-05 2016-04 41 Manual]
      2018-04-04T20:51:25.384-0300	imported 1 document
      

      But nothing is really imported into the database, which remains untouched like this:

      {
          "_id" : ObjectId("573378aef3af68090023da7d"),
          "creator" : "547517955021020200599440",
          "amountTransferred" : 101.79,
          "externalId" : "61fa09",
          "date" : ISODate("2016-05-06T16:00:00.000-03:00"),
          "payments" : [ 
              ObjectId("559363f127c09e0900b679dd"), 
              ObjectId("55bc4c9170b99e090093e2a8"), 
              ObjectId("55e5175a3b2a8e090040d4cd"), 
              ObjectId("560cab8bad3c6a0900275f5a"), 
              ObjectId("563cc8d3f2db060900a8ba81"), 
              ObjectId("5661033e57d24c090035b191"), 
              ObjectId("568eac27eaa71c090074d5b0"), 
              ObjectId("56b2e691ced93a0900408267"), 
              ObjectId("56d905cb4c830809007e8355"), 
              ObjectId("56fee8063cdd4d0900776fa9"), 
              ObjectId("5732732e5d237d09008c57e2")
          ],
          "__v" : 0
      }
      

      If I get the --collection fulfilledpayments parameter off it imports to a new collection, but of course there in no need for the merge mode there because it doesn't contain the _id to be matched.

            Assignee:
            david.golden@mongodb.com David Golden
            Reporter:
            hhe Hernán Efrón
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: