Uploaded image for project: 'MongoDB ETL Tools'
  1. MongoDB ETL Tools
  2. TOOLS-2378

mongodump will not combine --uri and --db, forcing URI parsing and reassembly in shell scripts is problematic

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Accepted
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: 4.0.4, 3.6.14
    • Fix Version/s: None
    • Component/s: mongodump
    • Labels:
      None

      Description

      This command:

      mongodump --uri=[atlas URI here] --db=specificdbname

      Throws the following error:

      error parsing command line options: illegal argument combination: cannot specify --db and --uri

      While a URI can convey the database name and certainly should be allowed to, hosting platforms like MongoDB Atlas provide developers with a general purpose URI to a cluster. In fact, the Atlas-provided URI contains the database name "test" but no one expects the developer to really want the "test" database.

      When scripting it is not uncommon that you need the "foo" database from the cluster. However rebuilding the URI in the context of a shell script is problematic. One can search-and-replace "/test", but there's no knowing if this convention of including "/test" is universal or even something that will continue, so you need extra logic to make sure it is there, etc.

      Yes, you can do a better job rebuilding the URL if you pull it into something like node or python but our little bash script just got awfully complicated. (:

      Please allow --uri and --db to be combined. --db should override the database name present in --uri.

      A commenter on issue TOOLS-2151 has also pointed out the inconsistency of refusing the combination in mongodump, but requiring the combination in mongorestore.

      Thanks!

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                ops@apostrophecms.com Apostrophe Cloud
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: