Skip to content

Instantly share code, notes, and snippets.

@c0nrad

c0nrad/ingest.js Secret

Created Jan 8, 2021
Embed
What would you like to do?
exports = function(payload, response) {
const {db, collection} = payload.query;
const body = EJSON.parse(payload.body.text())
console.log("db, collection: ", db, collection);
console.log("Request body:", body);
body.ts = new Date(body.ts)
context.services.get("mongodb-atlas").db(db).collection(collection).insertOne(body)
return "{'msg':'keep the change you filthy animal'}";
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment