Created
March 3, 2019 11:46
Star
You must be signed in to star a gist
Receive POST from Google Sheets and Insert into MongoDB Database
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 = async function(payload) { | |
const mongodb = context.services.get("mongodb-atlas"); | |
const eventsdb = mongodb.db("events"); | |
const eventscoll = eventsdb.collection("events"); | |
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