Last active
July 22, 2018 21:18
-
-
Save mrlynn/f0cd325e223d0b622280e37659d12607 to your computer and use it in GitHub Desktop.
Example MongoDB Stitch Serverless Function to call an Amazon Kinesis to put a record
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports = function(event){ | |
const awsService = context.services.get('aws'); | |
console.log(JSON.stringify(event.fulldocument)); | |
try{ | |
awsService.kinesis().PutRecord({ | |
Data: JSON.stringify(event.fullDocument), | |
StreamName: "stitchStream", | |
PartitionKey: "1" | |
}).then(function(response) { | |
return response; | |
}); | |
} | |
catch(error){ | |
console.log(JSON.parse(error)); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment