Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-18089

Mongoimport claims it imported 0 documents when it successfully imports.

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

      I'm finding that mongoimport is claiming 0 documents imported when the number is higher. This happens for me in a use case when there are duplicate key errors, but the mongoimport is still able to proceed.

      This can lead to confusion in circumstances when users aren't checking directly to see the results of the mongoimport. This is the case for students in our current m101 courses, because they have a homework problem that requires them to mongoimport data.

      Steps to reproduce:

      • First, use the attached zips.json file, then perform a mongoimport with
      mongoimport -d test -c zips --drop zips.json
      
      (old_sand)~/Downloads % mongo
      MongoDB shell version: 3.0.2
      connecting to: test
      > db.zips.count()
      29467
      > db.zips.drop()
      true
      > db.zips.count()
      0
      >
      bye
      (old_sand)~/Downloads % mongoimport -d test -c zips --drop zips.json
      2015-04-16T15:21:47.844-0400	connected to: localhost
      2015-04-16T15:21:47.844-0400	dropping: test.zips
      2015-04-16T15:21:47.967-0400	error inserting documents: E11000 duplicate key error index: test.zips.$_id_ dup key: { : "32350" }
      2015-04-16T15:21:48.097-0400	error inserting documents: E11000 duplicate key error index: test.zips.$_id_ dup key: { : "63673" }
      2015-04-16T15:21:48.228-0400	error inserting documents: E11000 duplicate key error index: test.zips.$_id_ dup key: { : "42223" }
      2015-04-16T15:21:48.228-0400	imported 0 documents
      (old_sand)~/Downloads % mongo
      MongoDB shell version: 3.0.2
      connecting to: test
      > db.zips.count()
      29467
      >
      

        1. zips.json
          2.74 MB
          William Cross

            Assignee:
            ramon.fernandez@mongodb.com Ramon Fernandez Marina
            Reporter:
            william.cross William Cross
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: