Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-2301

In shell, the "db address" argument has ambiguous syntax

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 1.6.5
    • Component/s: Shell
    • Labels:
      None

      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
      mongo db1-1 # this was intended to be a hostname, but....

      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
      foo ==> host foo, no database specified
      /bar ==> localhost, database bar

      would eliminate these types of easy-to-make, difficult-to-detect errors.

            Assignee:
            backlog-server-platform DO NOT USE - Backlog - Platform Team
            Reporter:
            roysmith Roy Smith
            Votes:
            2 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: