Using plugins
Plugins are used by either importing a module, or installing the relevant package, and then calling theuse method.
Depending on the plugin, options may be provided.
Writing plugins
A plugin is nothing more than anasync function that performs customizations.
Write your own plugin
Each plugin is nothing more than anasync function that can perform customizations at either Back-end level, Collection level, or both.
| Name | Description |
|---|---|
dataSource | An object that allows customizing the whole agent. It has the same interface as the Agent you manipulate outside of plugins |
collection | An object that allows customizing the collection that the plugin was called from (null if the plugin was called on the Back-end). It is the same object passed when you call customizeCollection |
options | Options that are provided to the plugin. There is no set structure for this parameter, as each plugin will provide specific mandatory or optional options |
Making your plugin act differently depending on the collection
When making a plugin, you may want it to generalize to many different Collections. This can be achieved by adopting different behavior depending on theschema of the Collection being targeted.