@andrew-wolf/mongodb_connect

1.0.3 • Public • Published

Install

# with npm
$ npm install @andrew-wolf/mongodb_connect

Usage

const mongodb_connect = require('@andrew-wolf/mongodb_connect');

Create a .env file in the root directory of your project. Add the following environment-specific variables on new lines in the form of NAME=VALUE. For example:

DB_ACCESS=local
(local or cloud)
DATABASE_ATLAS_SERVER=cluster0-5mdsk.gcp.mongodb.net
DATABASE_ATLAS_USER=userName
DATABASE_ATLAS_PASSWORD=Pwd
DATABASE_LOCAL_IP=serverIp
DATABASE_LOCAL_PORT=serverPort
DATABASE_LOCAL_USER=userName
DATABASE_LOCAL_PASSWORD=Pwd
DATABASE_NAME=databaseName

process.env now has the keys and values you defined in your .env file.

mongodb_connect.connect(process.env.DB_ACCESS);

Package Sidebar

Install

npm i @andrew-wolf/mongodb_connect

Weekly Downloads

3

Version

1.0.3

License

ISC

Unpacked Size

2.39 kB

Total Files

3

Last publish

Collaborators

  • andrew-wolf