Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Receive POST from Google Sheets and Insert into MongoDB Database
exports = async function(payload) {
const mongodb ="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