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

mongoimport should error if field name starts with '$'

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.8.0-rc3
    • Affects Version/s: None
    • Component/s: mongoimport
    • Labels:
      None
    • Completed

      writing a bunch of tests to check for invalid options. mongoimport fails (as expected) but the error message suggests that its failing for the wrong reason. instead it just says "bare '' in non-quoted field" on each one.

      ----
      Testing: --fields containing blank fields should fail
      ----
      2014-12-05T17:26:56.501-0500 I -        shell: started program (sh84375):  /Users/michaelobrien/projects/mongo-tools/test/qa-tests/mongoimport --db test -c test --file /data/db/jstests_tool_incompatible_flags_external/a.csv --type=csv --fields a,,b --host 127.0.0.1:31000
       m31000| 2014-12-05T17:26:56.505-0500 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:59789 #8 (2 connections now open)
      sh84375| 2014-12-05T17:26:56.506-0500	connected to: 127.0.0.1:31000
      sh84375| 2014-12-05T17:26:56.506-0500	error encountered while importing documents: read error on entry #1: line 1, column 1: bare " in non-quoted-field
      sh84375| 2014-12-05T17:26:56.506-0500	imported 0 documents
      
      ----
      Testing: --fields containing a field containing a $ should fail
      ----
      
      
      2014-12-05T17:26:56.494-0500 I -        shell: started program (sh84374):  /Users/michaelobrien/projects/mongo-tools/test/qa-tests/mongoimport --db test -c test --file /data/db/jstests_tool_incompatible_flags_external/a.csv --type=csv --fields a,$xz,b --host 127.0.0.1:31000
       m31000| 2014-12-05T17:26:56.498-0500 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:59786 #7 (2 connections now open)
      sh84374| 2014-12-05T17:26:56.499-0500	connected to: 127.0.0.1:31000
      sh84374| 2014-12-05T17:26:56.500-0500	error encountered while importing documents: read error on entry #1: line 1, column 1: bare " in non-quoted-field
      sh84374| 2014-12-05T17:26:56.500-0500	imported 0 documents
       m31000| 2014-12-05T17:26:56.500-0500 I NETWORK  [conn7] end connection 127.0.0.1:59786 (1 connection now open)
      
      ----
      Testing: --fields containing a field containing a . should fail
      ----
      
      
      2014-12-05T17:26:56.487-0500 I -        shell: started program (sh84373):  /Users/michaelobrien/projects/mongo-tools/test/qa-tests/mongoimport --db test -c test --file /data/db/jstests_tool_incompatible_flags_external/a.csv --type=csv --fields a,x.z,b --host 127.0.0.1:31000
       m31000| 2014-12-05T17:26:56.492-0500 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:59783 #6 (2 connections now open)
      sh84373| 2014-12-05T17:26:56.492-0500	connected to: 127.0.0.1:31000
      sh84373| 2014-12-05T17:26:56.493-0500	error encountered while importing documents: read error on entry #1: line 1, column 1: bare " in non-quoted-field
      sh84373| 2014-12-05T17:26:56.493-0500	imported 0 documents
       m31000| 2014-12-05T17:26:56.494-0500 I NETWORK  [conn6] end connection 127.0.0.1:59783 (1 connection now open)
      
      

            Assignee:
            adinoyi.omuya@mongodb.com Adinoyi Omuya
            Reporter:
            mikeo@mongodb.com Michael O'Brien
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: