var _ = require('lodash');
Moving to unplanned (backlog). This was incorrectly labeled under review.
would be simple enough to add npm support for lodash, etc. using similar structure as Azure Functions which will bring in any dependencies specified in packages.json. would expect more interest here as people do more with server-side processing (triggers / stored procs). maybe packages.json config can be specified per trigger/sproc or perhaps globally.
Larry Maccherone commented
The open source project documentdb-utils (https://github.com/lmaccherone/documentdb-utils#support-for-require-in-server-side-scripts) has support for "require()" from inside scripts. It essentially embeds the specified package into your stored procedure before sending it up to DocumentDB. I couldn't get lodash to work but underscore.js is fully tested as is async.js.
Eric Henson commented
I do agree with the challenge presented with the comment on March 9, 2016 but, with that aside, to be able to load your own libraries for you business logic will be a great feature instead of having to copy and paste it across all of your stored procedures. Maybe they can provide a container of which we can upload shareable scripts and even provide a shared repository of scripts across their user base.