Skip to content

Instantly share code, notes, and snippets.

@agramonte
Last active Dec 16, 2021
Embed
What would you like to do?
exports = function(payload, response) {
const {params, collection, documentName} = payload.query;
const contentTypes = payload.headers["Content-Type"];
const body = payload;
var data = JSON.parse(params);
var filter = {};
if (documentName != undefined && documentName != "") {
filter["Name"] = documentName;
data.Name = documentName;
} else {
filter["Name"] = data.Name;
}
var option = {};
option.upsert = true;
context.services.get("mongodb-atlas").db("chancleta").collection(collection).replaceOne(
filter,
data,
option
)
response.setBody('{"Status":"Success"}');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment