I have a function defined called func1 in file file_a.js
I have another file file_b.js, in which I want to use the function func1.
Can I do this inside mongo environment?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Amended answer thanks to AD7six
Mongodb console can take multiple input file loaded in order specified.
Or you can use the built in load function like this
test.js is the file given to mongodb console, it loads test2.js(containing function foo) and calls foo