Modularity cannot be used in mongodb-shell, such as "import" or "require"

Modularity cannot be used in mongodb-shell, such as “import” or “require”

@masx200_masx200 Yes, that is expected. The current mongo shell provides a limited JavaScript environment for interaction with a MongoDB deployment, but is not have a complete scripting environment like Node.js. You can use load() to eval JavaScript from an external file into the current mongo session, but there is no equivalent for require or streaming I/O functions.

For more advanced scripting, use a supported MongoDB driver such as the Node.js driver.

Regards,
Stennie

thanks for your help

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.