
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
mongo-to-postgres
Advanced tools
This tiny tool is used for easy data migration from MongoDb database
to PostgreSQL database. It uses appropriate ORMs: mongoose and
knex respectively to transfer data.
$ yarn add mongo-to-postgres
OR
$ npm i mongo-to-postgres
migrate.js, set migration settings in itIMPORTANT NOTES
1. You MUST respect the order of the tables. Tables with foreign keys MUST BE placed AFTER tables, from which these keys are.
2. This sample assumes that you have postgres database with schema, containing empty tables.
import migrate from 'mongo-to-postgres';
migrate({
// Define connection strings
connections: {
mongo: 'mongodb://localhost/dbname',
postgres: 'postgres://postgres:secret@localhost:5432/dbname'
},
// Define your database migration settings
collections: [
{
collectionName: 'department', // collection name in Mongo
tableName: 'departments', // table name in Postgres
fieldsRename: [
['createdAt', 'created_at'], // set new name for field (optional)
['updatedAt', 'updated_at'] // set new name for other field (optional)
],
fieldsRedefine: [
['dep_type', 1] // force to set value for all records (optional)
]
},
{
collectionName: 'award', // collection name in Mongo
tableName: 'awards', // table name in Postgres
},
{
collectionName: 'employee', // collection name in Mongo
tableName: 'employees', // table name in Postgres
foreignKeys: {
department: 'department', // foreign keys (field: collection) (optional)
},
links: { // "many-to-many" links
awards: ['emplyees__awards', 'employee_id', 'award_id']
}
}
]
});
package.json "type" field{
"type": "module",
"dependencies": {
"mongo-to-postgres": "^0.0.6"
}
}
$ node migrate.js
FAQs
Simple data migration from MongoDb to PostgreSQL
The npm package mongo-to-postgres receives a total of 9 weekly downloads. As such, mongo-to-postgres popularity was classified as not popular.
We found that mongo-to-postgres demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.