feat: Add $setOnInsert operator to Parse.Server.database.update (#8791)
This commit is contained in:
@@ -279,6 +279,9 @@ const flattenUpdateOperatorsForCreate = object => {
|
||||
}
|
||||
object[key] = object[key].amount;
|
||||
break;
|
||||
case 'SetOnInsert':
|
||||
object[key] = object[key].amount;
|
||||
break;
|
||||
case 'Add':
|
||||
if (!(object[key].objects instanceof Array)) {
|
||||
throw new Parse.Error(Parse.Error.INVALID_JSON, 'objects to add must be an array');
|
||||
@@ -1817,7 +1820,7 @@ class DatabaseController {
|
||||
keyUpdate &&
|
||||
typeof keyUpdate === 'object' &&
|
||||
keyUpdate.__op &&
|
||||
['Add', 'AddUnique', 'Remove', 'Increment'].indexOf(keyUpdate.__op) > -1
|
||||
['Add', 'AddUnique', 'Remove', 'Increment', 'SetOnInsert'].indexOf(keyUpdate.__op) > -1
|
||||
) {
|
||||
// only valid ops that produce an actionable result
|
||||
// the op may have happened on a keypath
|
||||
|
||||
Reference in New Issue
Block a user