diff --git a/spec/ParseObject.spec.js b/spec/ParseObject.spec.js index 4afc48c4cc..da8ee45217 100644 --- a/spec/ParseObject.spec.js +++ b/spec/ParseObject.spec.js @@ -1328,7 +1328,7 @@ describe('Parse.Object testing', () => { }); }); - it_exclude_dbs(['postgres'])("bytes work", function(done) { + it("bytes work", function(done) { Parse.Promise.as().then(function() { var obj = new TestObject(); obj.set("bytes", { __type: "Bytes", base64: "ZnJveW8=" }); diff --git a/spec/Schema.spec.js b/spec/Schema.spec.js index 3329bd4bfc..8bbe9dacfa 100644 --- a/spec/Schema.spec.js +++ b/spec/Schema.spec.js @@ -523,6 +523,7 @@ describe('SchemaController', () => { aFile: {type: 'File'}, aPointer: {type: 'Pointer', targetClass: 'ThisClassDoesNotExistYet'}, aRelation: {type: 'Relation', targetClass: 'NewClass'}, + aBytes: {type: 'Bytes'}, })) .then(actualSchema => { const expectedSchema = { @@ -542,6 +543,7 @@ describe('SchemaController', () => { aFile: { type: 'File' }, aPointer: { type: 'Pointer', targetClass: 'ThisClassDoesNotExistYet' }, aRelation: { type: 'Relation', targetClass: 'NewClass' }, + aBytes: {type: 'Bytes'}, }, classLevelPermissions: { find: { '*': true }, diff --git a/src/Adapters/Storage/Mongo/MongoSchemaCollection.js b/src/Adapters/Storage/Mongo/MongoSchemaCollection.js index e6dbd4ae18..46d8a50839 100644 --- a/src/Adapters/Storage/Mongo/MongoSchemaCollection.js +++ b/src/Adapters/Storage/Mongo/MongoSchemaCollection.js @@ -97,6 +97,7 @@ function parseFieldTypeToMongoFieldType({ type, targetClass }) { case 'Array': return 'array'; case 'GeoPoint': return 'geopoint'; case 'File': return 'file'; + case 'Bytes': return 'bytes'; } } diff --git a/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js b/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js index cd82ade4b5..778b112865 100644 --- a/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js +++ b/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js @@ -28,6 +28,7 @@ const parseTypeToPostgresType = type => { case 'Pointer': return 'char(10)'; case 'Number': return 'double precision'; case 'GeoPoint': return 'point'; + case 'Bytes': return 'jsonb'; case 'Array': if (type.contents && type.contents.type === 'String') { return 'text[]'; @@ -769,6 +770,7 @@ export class PostgresStorageAdapter { } break; case 'Object': + case 'Bytes': case 'String': case 'Number': case 'Boolean': diff --git a/src/Controllers/SchemaController.js b/src/Controllers/SchemaController.js index a16a59571a..f29763be04 100644 --- a/src/Controllers/SchemaController.js +++ b/src/Controllers/SchemaController.js @@ -216,6 +216,7 @@ const validNonRelationOrPointerTypes = [ 'Array', 'GeoPoint', 'File', + 'Bytes' ]; // Returns an error suitable for throwing if the type is invalid const fieldTypeIsInvalid = ({ type, targetClass }) => { @@ -966,7 +967,7 @@ function getObjectType(obj) { break; case 'Bytes' : if(obj.base64) { - return; + return 'Bytes'; } break; }