I have two Mongodb shell scripts written in js. Both are sharing some code between them. Is it possible to extract that code to another file and to import it from there? And how?
I have been trying with require / import
but that obviously not working, also tried with load()
but no success.
I know it is using the SpiderMonkey js engine, but no idea if it is possible.
Yes! The solution is .mongorc.js file at your home directory.
Check documentation here!