Mongo shell as an interactive JavaScript interpreter
Do you have MongoDB installed? If you do then you have JavaScript interpreter. MongoDB has SpiderMonkey JavaScript engine. To start an interactive shell you have to type mongo --nodb
in the shell.
And of course the shell allows you to use loops, user functions and etc.:
You can also use the cat
function to read the file’s contents.
You may even explore global scope by executing printjson(this)
and find out the following functions:
And finally, you can run a JavaScript file using MongoDB shell.
Happy coding =]