Skip to content

A simple way to connect with mongodb. This is not Moongose, only a simple way to deal with a database.

License

Notifications You must be signed in to change notification settings

flpms/simple-connection

Repository files navigation

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

About

A simple way to connect with mongodb. This is not Moongose, only a simple way to deal with a database.

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published