[SERVER-2301] In shell, the "db address" argument has ambiguous syntax Created: 29/Dec/10 Updated: 21/Aug/18 Resolved: 21/Aug/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Shell |
| Affects Version/s: | 1.6.5 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Roy Smith | Assignee: | DO NOT USE - Backlog - Platform Team |
| Resolution: | Done | Votes: | 2 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Participants: | |||||
| Description |
|
If you run "mongo foo", the argument "foo" could be either a hostname or database name. For example: mongo db1-1.songza.com # this is a hostname to connect to In the example above (a mistake I've made numerous times), if the name resolver search path isn't set up right, "db1-1" doesn't resolve to a hostname, so the shell assumes it's a database name. The fact that the database doesn't exist is not an error, so you just get: connecting to: db1-1 which looks VERY much like what you expected, but it's not. You're connected to localhost. It would be better if the syntax was changed to be unambiguous. For example: foo/bar ==> database bar on host foo would eliminate these types of easy-to-make, difficult-to-detect errors. |
| Comments |
| Comment by Matt Lord (Inactive) [ 21/Aug/18 ] | |||||||||||||||||||||||||||
|
Hi roysmith, I'm closing this for now as I cannot repeat the issue in 4.0:
If I missed something please let me know and I can re-open the ticket. Thank you for using MongoDB! | |||||||||||||||||||||||||||
| Comment by Asya Kamsky [ 16/Aug/18 ] | |||||||||||||||||||||||||||
|
The shell does show what it's doing now:
| |||||||||||||||||||||||||||
| Comment by Roy Smith [ 30/Dec/10 ] | |||||||||||||||||||||||||||
|
At the very least, if the shell said, "connecting to: host=localhost, db=db1-1", at least there would be some useful feedback that things were not going as you expected. But, making the syntax unambiguous would be better. | |||||||||||||||||||||||||||
| Comment by Eliot Horowitz (Inactive) [ 29/Dec/10 ] | |||||||||||||||||||||||||||
|
Agreed its a bit strange, though a lot of people like it. |