是否可以在 MongoDB 指南针中使用 mongorc.js?

Is it possible to use a mongorc.js in MongoDB Compass?

我想在 MongoDB Compass 中使用 mongorc.js 中定义的自定义命令。这可能吗? 是否可以在 MongoDB 指南针中使用 mongorc.js

Compass 不支持 mongo shell 的 mongorc.js 启动文件概念。 mongo shell 是较低级别的 JavaScript 控制台环境,为管理员提供一些基本的脚本编写功能; Compass 是一个桌面应用程序,不允许任意执行 user-provided JavaScript.

但是,如果您想自定义 Compass,可以 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 contextmongo shell.

相比

实施插件肯定比简单的 JavaScript 包含更复杂,但如果您想调整您的管理员 UI(并可能与其他人共享插件),则有一些有趣的可能性。

有关详细信息,请参阅:Plugin Tutorials and Compass Plugin Reference