mongodb-to-postgresql
mongodb-to-postgresql copied to clipboard
error: malformed array literal: "[USA]"
I am using the mongodb_sample_schema, with the following transformation and encountering the error: malformed array literal: "[USA]" when when running "node start.js migratedata".
// data_model.js movies: [ 'movies', '_id VARCHAR(50) PRIMARY KEY NOT NULL', 'plot TEXT', 'genras TEXT[]', '"cast" TEXT[]', 'title TEXT', 'year NUMERIC', 'runtime NUMERIC', 'num_mflix_comments NUMERIC', 'fullplot TEXT', 'countries TEXT[]', 'type VARCHAR(100)', 'tomatoes JSONB', 'awards JSONB', ],
I also encountered a number of other problems mainly with the package.json but after upgrading some of the packages the createdb errors disappeared.
{ "name": "mongodb-to-postgres-npm", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC", "dependencies": { "async": "^3.1.0", "async-waterfall": "^0.1.5", "moment": "^2.24.0", "mongodb": "^4.2.2", "pg": "^8.7.1" } }
I think this is mostly because postgress expects the array in countries to be presented as {USA} and not [USA]