Compass allows specifying a connection string or connection on the command line. Similar to DOCSP-25219, Compass is invoked through the path to its executable.
Variant 1: Specify a connection string
Compass can be run as "<path/to/compass/executable> <connection string>", e.g. mongodb-compass mongodb://my.cluster.mongodb.net/.
Variant 2: Specify a connection from an exported connection file
DOCSP-25219 describes how to export connections into a file. This can include more information than a connection string, such as In-Use Encryption parameters or SSH tunnel parameters. If such a file is present, Compass can be run as "<path/to/compass/executable> --file=<filename> [--passphrase=<passphrase>] [<connection id>]", where "filename" is the filename to the connections list file, "passphrase" is the passphrase provided when exporting connections (if any). "connection id" is the value of the "id" attribute in the connections list file and only needs to be specified if there is more than one connection in the exported file.
Compass will attempt to connect automatically in these cases. If there is an error while loading, parsing or decrypting the connection string/file, or an error while connecting, Compass will still display its UI and act as if the error came from a regular connection attempt through the connection form.
We expect this feature to be used in conjunction with the --protectConnectionStrings command line option, which is going to be implemented in COMPASS-6066.