Fix problems with _keys in nested objects
This commit is contained in:
@@ -586,7 +586,7 @@ function transformUpdateOperator(operator, flatten) {
|
||||
|
||||
// Converts from a mongo-format object to a REST-format object.
|
||||
// Does not strip out anything based on a lack of authentication.
|
||||
function untransformObject(schema, className, mongoObject) {
|
||||
function untransformObject(schema, className, mongoObject, isNestedObject = false) {
|
||||
switch(typeof mongoObject) {
|
||||
case 'string':
|
||||
case 'number':
|
||||
@@ -683,10 +683,8 @@ function untransformObject(schema, className, mongoObject) {
|
||||
objectId: objData[1]
|
||||
};
|
||||
break;
|
||||
} else if (key[0] == '_' && key != '__type') {
|
||||
} else if (!isNestedObject && key[0] == '_' && key != '__type') {
|
||||
throw ('bad key in untransform: ' + key);
|
||||
//} else if (mongoObject[key] === null) {
|
||||
//break;
|
||||
} else {
|
||||
var expectedType = schema.getExpectedType(className, key);
|
||||
var value = mongoObject[key];
|
||||
@@ -700,7 +698,7 @@ function untransformObject(schema, className, mongoObject) {
|
||||
}
|
||||
}
|
||||
restObject[key] = untransformObject(schema, className,
|
||||
mongoObject[key]);
|
||||
mongoObject[key], true);
|
||||
}
|
||||
}
|
||||
return restObject;
|
||||
|
||||
Reference in New Issue
Block a user