Skip to content

Latest commit

 

History

History
44 lines (29 loc) · 1.22 KB

README.md

File metadata and controls

44 lines (29 loc) · 1.22 KB

Simple Connection - Pull Request Code Climate

Description

A utility mongo wrapper connection to simplify the use of the native mongodb driver.

Our legacy description from a 9 year old package

A small implementation to use mongodb with native drives provided by mongodb, but with promises.

Installation

npm install simple-connection

Usage - v4

import SimpleConnection from 'simple-connection';

(async() => {
  const db = new SimpleConnection("mongodb://testRoot:testRootSecret@localhost:27017/TEST");

  try {
    // open database connection
    await db.open();

    // get collection
    collection = await db.collection("collection_test");
  } catch() {
    console.error("Error connecting to database");
  } finally {
    // close the connection
    db.client.close();
  }
})()

Old versions

V3