Question:
Can I use node modules in MongoBooster? I want to use axios in my script. And, Do I have to install node module globally?
Answer:
Yes, You can use pure JS node modules in MongoBooster. And, you don't need to install node modules globally.
- Launch MongoBooster.
- Execute Main Menu -> Help ->
Open the Executable Directory
(or "Open User Data Directory" in the old version) - New Terminal at this folder
1 | npm i axios # run it in MongoBooster user data directory |
After successfully installing this package in the MongoBooster User Data Directory, you can require and access it in the MongoBooster script.
1 | const axios=require("axios"); |
The "await" is a build-in method in MongoBooster. You can use it to await a promise or a promise array.
Run it and got result.
1 | { |
Use your own javascript files
NoSQLBooster supports CommonJS module, each file is treated as a separate module. For example, consider a file named "c://test/myproject/utils.js"
1 | c://test/myproject/utils.js |
then import "c://test/myproject/utils.js" in your script.
1 | const {replaceStr}= require("c://test/myproject/utils.js"); |
Now, you can assemble packages like building blocks in your MongoDB shell script. The npm registry hosts almost half a million packages of free, reusable code — the largest software registry in the world.
Thank you!
Please visit our feedback page or click the “Feedback” button in the app. Feel free to suggest improvements to our product or service. Users can discuss your suggestion and vote for and against it. We’ll look at it too.