Mongo object to Parse object date serialization - avoid re-serialization of iso of type Date (#3389)

* Mongo object to Parse object date serialization - avoid nested ios

* Mongo object to Parse object date serialization

* Remove file from previous commit
This commit is contained in:
nodechefMatt
2017-02-04 11:32:35 -05:00
committed by Tyler Brock
parent 49dc8df1de
commit ecf422b2d9
2 changed files with 31 additions and 0 deletions

View File

@@ -726,6 +726,11 @@ const nestedMongoObjectToNestedParseObject = mongoObject => {
return BytesCoder.databaseToJSON(mongoObject);
}
if (mongoObject.hasOwnProperty('__type') && mongoObject.__type == 'Date' && mongoObject.iso instanceof Date) {
mongoObject.iso = mongoObject.iso.toJSON();
return mongoObject;
}
return _.mapValues(mongoObject, nestedMongoObjectToNestedParseObject);
default:
throw 'unknown js type';