I'd like to use my custom commands defined in a mongorc.js in MongoDB Compass. Is this possible? Is it possible to use a mongorc.js in MongoDB Compass?
Compass does not support the mongo
shell's notion of a mongorc.js
startup file. The mongo
shell is a lower level JavaScript console environment that provides some basic scripting capabilities for administrators; Compass is a desktop application which does not allow arbitrary execution of user-provided JavaScript.
However, if you want to customise Compass it is possible to Create Compass Plugins which are implemented as ReactJS modules. Compass plugins extend predefined roles in the Compass UI (such as the global header, database-level tabs, or collection-level tabs) and run in a much more limited security context as compared to the mongo
shell.
Implementing a plugin is definitely more involved than a simple JavaScript include, but there are interesting possibilities if you want to tweak your admin UI (and perhaps share plugins with others).
For more information see: Plugin Tutorials and Compass Plugin Reference.