Fix an issue in MongoTransform where transforming object type fields with null values fails (#2029)

This commit is contained in:
Dan Huang
2016-06-10 13:44:41 -07:00
committed by Drew
parent a00d795404
commit 11301d9590
3 changed files with 11 additions and 2 deletions

View File

@@ -83,7 +83,7 @@ const transformKeyValueForUpdate = (className, restKey, restValue, parseFormatSc
}
const transformInteriorValue = restValue => {
if (typeof restValue === 'object' && Object.keys(restValue).some(key => key.includes('$') || key.includes('.'))) {
if (restValue !== null && typeof restValue === 'object' && Object.keys(restValue).some(key => key.includes('$') || key.includes('.'))) {
throw new Parse.Error(Parse.Error.INVALID_NESTED_KEY, "Nested keys should not contain the '$' or '.' characters");
}
// Handle atomic values