[SERVER-12165] mongoimport broken w/no-args Created: 19/Dec/13  Updated: 11/Jul/16  Resolved: 30/Dec/13

Status: Closed
Project: Core Server
Component/s: Tools
Affects Version/s: 2.5.4
Fix Version/s: 2.5.5

Type: Bug Priority: Critical - P2
Reporter: Scott Hernandez (Inactive) Assignee: Shaun Verch
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-3442 mongoimport should take collection na... Closed
Backwards Compatibility: Major Change
Operating System: ALL
Participants:

 Description   

When running mongoimport without any options it seems to default to the "" collection (since the file is not validated) and reading input from stdin instead of showing help.

Just for fun, I typed in a doc as you can see below:

$mongoimport 
connected to: 127.0.0.1
no collection specified!
using filename '' as collection.
 
{_id:1}
2013-12-19T09:09:10.191-0500 error: Invalid ns [test.]
 



 Comments   
Comment by Githook User [ 30/Dec/13 ]

Author:

{u'username': u'Zarkantho', u'name': u'Shaun Verch', u'email': u'shaun.verch@10gen.com'}

Message: SERVER-12165 Only fallback on using the file name when a file name is actually specified
Branch: master
https://github.com/mongodb/mongo/commit/1b599c9f17c6dd10b320e5d642a03604164aec2d

Comment by Asya Kamsky [ 27/Dec/13 ]

I believe this is a bigger problem than mongoimport. mongosniff also broken:

$ ~/bins/mongodb-osx-x86_64-2.5.3/bin/mongosniff --help
Error parsing command line: unknown option help
try '/Users/asya13/bins/mongodb-osx-x86_64-2.5.3/bin/mongosniff --help' for more information
 
$ ~/bins/mongodb-osx-x86_64-2.5.2/bin/mongosniff --help
Usage: mongosniff [--help] [--forward host:port] [--source (NET <interface> | (FILE | DIAGLOG) <filename>)] [<port0> <port1> ... ]
--forward       Forward all parsed request messages to mongod instance at
                specified host:port
--source        Source of traffic to sniff, either a network interface or a
                file containing previously captured packets in pcap format,
                or a file containing output from mongod's --diaglog option.
                If no source is specified, mongosniff will attempt to sniff
                from one of the machine's network interfaces.
--objcheck      Log hex representation of invalid BSON objects and nothing
                else.  Spurious messages about invalid objects may result
                when there are dropped tcp packets.
<port0>...      These parameters are used to filter sniffing.  By default,
                only port 27017 is sniffed.
--help          Print this help message.
 

Comment by Asya Kamsky [ 27/Dec/13 ]

This got broken between 2.5.2 and 2.5.3.

$ ~/bins/mongodb-osx-x86_64-2.5.2/bin/mongoimport
connected to: 127.0.0.1
no collection specified!
Import CSV, TSV or JSON data into MongoDB.
 
When importing JSON documents, each document must be a separate line of the input file.
 
Example:
  mongoimport --host myhost --db my_cms --collection docs < mydocfile.json
 
$ ~/bins/mongodb-osx-x86_64-2.5.3/bin/mongoimport
connected to: 127.0.0.1
no collection specified!
using filename '' as collection.
^C

Comment by Scott Hernandez (Inactive) [ 19/Dec/13 ]

This is a new issue; 2.4.8 does this:

mongoimport
connected to: 127.0.0.1
no collection specified!
Import CSV, TSV or JSON data into MongoDB.
 
When importing JSON documents, each document must be a separate line of the input file.
 
Example:
  mongoimport --host myhost --db my_cms --collection docs < mydocfile.json
...

Comment by Eric Milkie [ 19/Dec/13 ]

Is this a regression from 2.4?

Generated at Thu Feb 08 03:27:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.