1.0.3 • Published 4 years ago

@andrew-wolf/mongodb_connect v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

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);