mongo-pg-cli

1.0.4 • Public • Published

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

Package Sidebar

Install

npm i mongo-pg-cli

Weekly Downloads

1

Version

1.0.4

License

ISC

Unpacked Size

6.15 kB

Total Files

9

Last publish

Collaborators

  • rampooco