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

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.30latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.30
1.0.21
1.0.10
1.0.00

Package Sidebar

Install

npm i @andrew-wolf/mongodb_connect

Weekly Downloads

1

Version

1.0.3

License

ISC

Unpacked Size

2.39 kB

Total Files

3

Last publish

Collaborators

  • andrew-wolf