diff --git a/spec/ParseGlobalConfig.spec.js b/spec/ParseGlobalConfig.spec.js index c39c5c44e1..c728259b24 100644 --- a/spec/ParseGlobalConfig.spec.js +++ b/spec/ParseGlobalConfig.spec.js @@ -56,6 +56,49 @@ describe('a GlobalConfig', () => { }); }); + it('can add and retrive files', (done) => { + request.put({ + url : 'http://localhost:8378/1/config', + json : true, + body : { params: { file: { __type: 'File', name: 'name', url: 'http://url' } } }, + headers: { + 'X-Parse-Application-Id': 'test', + 'X-Parse-Master-Key' : 'test' + } + }, (error, response, body) => { + expect(response.statusCode).toEqual(200); + expect(body.result).toEqual(true); + Parse.Config.get().then((res) => { + const file = res.get('file'); + expect(file.name()).toBe('name'); + expect(file.url()).toBe('http://url'); + done(); + }); + }); + }); + + it('can add and retrive Geopoints', (done) => { + const geopoint = new Parse.GeoPoint(10,-20); + request.put({ + url : 'http://localhost:8378/1/config', + json : true, + body : { params: { point: geopoint.toJSON() } }, + headers: { + 'X-Parse-Application-Id': 'test', + 'X-Parse-Master-Key' : 'test' + } + }, (error, response, body) => { + expect(response.statusCode).toEqual(200); + expect(body.result).toEqual(true); + Parse.Config.get().then((res) => { + const point = res.get('point'); + expect(point.latitude).toBe(10); + expect(point.longitude).toBe(-20); + done(); + }); + }); + }); + it('properly handles delete op', (done) => { request.put({ url : 'http://localhost:8378/1/config', diff --git a/src/Adapters/Storage/Mongo/MongoTransform.js b/src/Adapters/Storage/Mongo/MongoTransform.js index e91abbb563..c048cba1aa 100644 --- a/src/Adapters/Storage/Mongo/MongoTransform.js +++ b/src/Adapters/Storage/Mongo/MongoTransform.js @@ -89,6 +89,9 @@ const transformKeyValueForUpdate = (className, restKey, restValue, parseFormatSc if (timeField && (typeof value === 'string')) { value = new Date(value); } + if (restKey.indexOf('.') > 0) { + return {key, value: restValue} + } return {key, value}; } @@ -98,7 +101,7 @@ const transformKeyValueForUpdate = (className, restKey, restValue, parseFormatSc return {key, value}; } - // Handle update operators + // Handle update operators if (typeof restValue === 'object' && '__op' in restValue) { return {key, value: transformUpdateOperator(restValue, false)}; }