First introduced in MongoDB 4.2, there are two magic keys added that are referred to as externally sourced or expansion directives. The two directives are __rest, allowing the use of a representational state transfer (REST) endpoint to obtain further configuration, and __exec, which loads configuration from the output of a shell or OS command.
IMPORTANT: In order to use the __rest expansion directive, you must start the mongod or mongos instance with this command-line option: --configExpand none|exec|rest|rest,exec. For more information, see the documentation on expansion directives here: https://docs.mongodb.com/manual/reference/expansion-directives/#expansion-directives-reference.