-
-
Save agramonte/d1c9cdaad44232bf50f8c4fdfcc900d9 to your computer and use it in GitHub Desktop.
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 = 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