Created
December 13, 2019 18:02
-
-
Save erajanraja24/b107b7d7c64d60a6951c5df5bbdc61af to your computer and use it in GitHub Desktop.
MongoDB Webhook function
This file contains hidden or 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 = async function(payload) { | |
const mongodb = context.services.get("mongodb-atlas"); | |
const eventsdb = mongodb.db("googlesheetsdb"); | |
const eventscoll = eventsdb.collection("employee_records"); | |
const result= await eventscoll.insertOne(payload.query); | |
var id = result.insertedId.toString(); | |
if(result) { | |
return JSON.stringify(id,false,false); | |
} | |
return { text: `Error saving` }; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment