How can we improve Azure Cosmos DB?

The ability to reference JavaScript libraries (e.g. underscore) within server-side scripting

It'd be nice to be able to reference javascript libraries within server-side scripting. Something like an AMD or RequireJS loader.

For example:
var _ = require('lodash');

50 votes
Vote
Sign in
(thinking…)
Sign in with: oidc
Signed in as (Sign out)
You have left! (?) (thinking…)
Andrew Liu shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

4 comments

Sign in
(thinking…)
Sign in with: oidc
Signed in as (Sign out)
Submitting...
  • Anonymous commented  ·   ·  Flag as inappropriate

    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  ·   ·  Flag as inappropriate

    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  ·   ·  Flag as inappropriate

    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.

  • Anonymous commented  ·   ·  Flag as inappropriate

    How on earth could Microsoft allow everyone to upload and reference third party JavaScript libraries (and all their dependencies) - in a SAAS database product?

Feedback and Knowledge Base