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

mongoimport imported count message seems incorrect if the process hits an error

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      So, running mongodb-3.2.6-rc version of mongoimport (without the --stopOnError flag)

      ~/Mongo $ /Users/kay/Mongo/mongodb-3.2.6-rc0/bin/mongoimport --db test --collection foo --file foo.txt  
      2016-04-29T13:35:19.550-0400	connected to: localhost
      2016-04-29T13:35:19.551-0400	error inserting documents: E11000 duplicate key error collection: test.foo index: _id_ dup key: { : 2.0 }
      2016-04-29T13:35:19.551-0400	imported 0 documents
      

      But it did insert the non-conflicting documents:

      >  db.foo.find()
      { "_id" : 2, "x" : 2 }
      

      but after doing the import

      > db.foo.find()
      { "_id" : 2, "x" : 2 }
      { "_id" : 3, "x" : 3 }
      { "_id" : 1, "x" : 1 }
      

      So, shouldn't the message tell me it imported 2 documents?

            Assignee:
            gabriel.russell@mongodb.com Gabriel Russell (Inactive)
            Reporter:
            kay.kim@mongodb.com Kay Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: