MongoDB.live, free & fully virtual. June 9th - 10th. Register Now MongoDB.live, free & fully virtual. June 9th - 10th. Register Now

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