Zsh completions for MongoDB server, database tools, and new MongoDB shell

G’day fans of zsh and MongoDB!

I just updated zsh completions to include options for the latest MongoDB server (4.4), Database Tools, and the new MongoDB Shell (mongosh).

If you’re a command-line user, zsh completions are helpers for <tab> completion of known parameters.

For example, if you’re looking for an ssl option for mongodump but can’t remember the exact name and case:

$ mongodump --ssl<tab>
--ssl                          -- Use SSL for all connections
--sslAllowInvalidCertificates  -- Allow connections to servers with invalid certificates
--sslAllowInvalidHostnames     -- Allow connections to servers with non-matching hostnames
--sslCAFile                    -- Certificate authority file for SSL
--sslCRLFile                   -- Certificate revocation list file for SSL
--sslFIPSMode                  -- Activate FIPS 140-2 mode at startup
--sslPEMKeyFile                -- PEM certificate/key file for SSl
--sslPEMKeyPassword            -- Password for key in PEM file for SSL

If options have a limited set of values, you can also tab-complete to select from available options:

mongoimport --type=<tab>
csv   json  tsv

For info on how to install, see: GitHub - JamesKovacs/zsh_completions_mongodb: ZSH completion files for MongoDB

If you have suggestions or feedback, please comment here or raise an issue on GitHub.

Thanks,
Stennie

3 Likes