Skip to content

Instantly share code, notes, and snippets.

@ealsur
Created January 30, 2018 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ealsur/628001d83719f1dfc34f52090bf86200 to your computer and use it in GitHub Desktop.
Save ealsur/628001d83719f1dfc34f52090bf86200 to your computer and use it in GitHub Desktop.
Azure Cosmos DB + Functions Cookbook - output collector index.js
module.exports = function (context, req) {
context.log('Detected ' + req.body.length + ' incoming documents');
context.bindings.documentsToStore = [];
for(let i = 0, len=req.body.length; i<len;i++){
const doc = req.body[i];
context.bindings.documentsToStore.push(doc);
}
context.done(null, {
status: 201, body: 'Processed ' + req.body.length + ' documents'
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment