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

mongoimport returns exit code 0 even when error prevents records from being inserted

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 3.0.1
    • Fix Version/s: 3.3.1, 3.2.8
    • Component/s: mongoimport
    • Labels:
      None
    • Environment:
      Amazon Linux
    • Backport Requested:
      v3.2, v3.0

      Description

      The following is preventing us from creating automated test scripts to validate bulk document imports. The mongo shell output generated by mongoimport appears to not be parseable in the remote host shell so the error condition cannot be captured.

      The mongoimport utility should return an error code rather than indicate success when this condition occurs.

      [ec2-user@ip-172-31-28-233 bin]$ mongoimport --port 27017 --db test --collection grades --jsonArray --file ../import/records.json
      2015-03-27T14:35:55.126+0000 connected to: localhost:27017
      2015-03-27T14:35:55.149+0000 error inserting documents: could not contact primary for replica set rs7
      2015-03-27T14:35:55.149+0000 imported 0 documents
      [ec2-user@ip-172-31-28-233 bin]$ echo $?
      0
      [ec2-user@ip-172-31-28-233 bin]$

        Attachments

        1.
        Backport to v3.0 TOOLS-1297 Sub-task Closed Unassigned  
        2.
        Backport to v3.2 TOOLS-1298 Sub-task Closed Unassigned  

          Activity

            People

            Assignee:
            judah.schvimer Judah Schvimer
            Reporter:
            rhoulihan Rick Houlihan
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: