[SERVER-7292] mongoimport misleading error message Created: 08/Oct/12 Updated: 11/Jul/16 Resolved: 04/Jul/14 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Tools |
| Affects Version/s: | 2.0.7, 2.2.0 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Gianfranco Palumbo | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 1 |
| Labels: | mongoimport, neweng | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Participants: | |||||
| Description |
|
Specially on Windows: When specifying a file to import with --file with a space (without double quotes),
mongoimport will *not* display:
But
This is misleading because it seems it refers to multiple document occurrences. Same error occurs on Mac:
|
| Comments |
| Comment by Gianfranco Palumbo [ 04/Jul/14 ] | |||||
| |||||
| Comment by Tad Marshall [ 09/Oct/12 ] | |||||
|
I wasn't actually trying to make a point, just describe what is happening and why this is the error message you see. This is certainly fixable with the addition of some code. We have access to the same argc/argv parameters that we are passing to Boost::program_options and we could add parsing that was better tuned to detecting typos and unquoted file specs with spaces. We could probably allow multiple occurrences of options and then complain after program_options gives them to us, so that program_options will not throw an exception, and then we could make our error message better. I agree that this is an unfriendly and unhelpful error message. | |||||
| Comment by Gianfranco Palumbo [ 09/Oct/12 ] | |||||
|
I understand you point, but wouldn't it be better "multiple command line options occurrences" or something similar to help avoid the confusion? | |||||
| Comment by Tad Marshall [ 08/Oct/12 ] | |||||
|
This exception is thrown by Boost::program_options because it sees two filenames specified: "D:\Parsely" and "data\articles_split.json". We display "ERROR: " followed by the text of the Boost::program_options::multiple_occurrences exception, which is "multiple occurrences", and then display the command line options help text. You get the same behavior if you provide two collection names or two database names. |