You can load helper functions from a JavaScript file to make working with data in the mongo shell easier.
I typically like to create a queries.js
file that contains a number of helper functions. You load a file in the shell like this:
> load('queries.js')
Since I keep editing the file and adding more helpers as I'm working, I usually add a helper function to the file that reloads itself to save a few keystrokes. Yup, I'm that lazy.
function update() {