Type: New Feature
Priority: Major - P3
Affects Version/s: 4.0.4, 3.6.14
Fix Version/s: None
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.