Skip to content

Instantly share code, notes, and snippets.

@kevinzhang96
kevinzhang96 / upsert.js
Created January 4, 2016 01:05
Upsert Parse Cloud
// Takes 3 parameters:
// class: the object type to update; a single String.
// restrictions: the set of column restrictions; a Dictionary.
// updates: the set of column updates; a Dictionary.
Parse.Cloud.define("upsert", function(request, response) {
var query = new Parse.Query(request.params.class);
var restrictions = JSON.parse(request.params.restrictions);
for (var key in restrictions) {