1.0.4 • Published 3 years ago

mongo-pg-cli v1.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

mongo-pg-cli

A workspace to work with mongo and postgres client

Installation

npm install -g mongo-pg-cli

How to use :

  1. Go to workspace parent directory and create config.js
module.exports = {
    mongodb: {
        uri: process.env.MONGO_URL || 'mongodb://localhost:27017',
        options: {
            useUnifiedTopology: true
        }
    },
    pg: {
        user: 'postgres',
        host: '127.0.0.1',
        database: 'mydb',
        password: 'password',
        port: 5432
    },
    workdir: 'scripts'
};
  1. Create directory with name according to the config and add file js {workdir}/filename.js :
module.exports = async (mongoClient, pgClient) => {
    console.log('running scripts');
};
  1. Run script with command below on the same directory with config.js
mongo-pg-cli run <filename>

References

Mongo client and pg client using below references