-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Environment:OS:
node.js / npm versions:
Additional info:
-
Developer Tools
-
Not Needed
Problem Statement/Rationale
My customer encountered an issue while testing the new version in their environment. Specifically, they faced problems related to using dependencies with require.
When they run the following script with mongosh:
function test() { const mathjs = require('mathjs'); return { mathjs: mathjs.evaluate('12.7 cm to inch'), } } console.log(test());
It resulted in a ReferenceError: require is not defined. Has the dependency management changed from mongosh 1.* to mongosh2.2?
The script worked correctly with mongosh 1.8.2. Unfortunately, this issue is hindering their benchmarking process.
Please be sure to attach relevant logs with any sensitive data redacted.
How to retrieve logs for: Compass; Shell
Steps to Reproduce
Run the script above
Expected Results
Require to not error
Actual Results
Require is erroring
Additional Notes
Any additional information that may be useful to include.
- is depended on by
-
MONGOSH-1739 Release mongosh 2.2.1
-
- Closed
-
- is duplicated by
-
MONGOSH-1737 "Require is not defined" when running mongosh with --eval
-
- Closed
-