Tech MongoDB: Execute Javascript Functions using Command line In this article, we'll see how we can execute JavaScript using various methods from our terminal. I'll show how we can use eval, a single javascript file, and importing a collection of javascript files to make things modular.