From http://docs.mongodb.org/manual/tutorial/write-scripts-for-the-mongo-shell/