Skip to content

Instantly share code, notes, and snippets.

@c0nrad

c0nrad/ingest.js Secret

Created January 8, 2021 21:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c0nrad/beb9dd7413b5b3438c94d83160bffefd to your computer and use it in GitHub Desktop.
Save c0nrad/beb9dd7413b5b3438c94d83160bffefd to your computer and use it in GitHub Desktop.
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