mongo-using

1.0.1 • Public • Published

mongo-using

A trifle, really. An implementation of scoped use for a mongo connection. See c-sharp 'using' or Python 'with'.

Installation

npm install mongo-using

Interface

import {db} from 'mongo-using';
var array = await db.use( mongo_url, mongo_dbname, async (db) => {
    return await db.collection('collection_name').find().toArray();
}); // db connection is closed when you leave the scope
console.log(array);

/mongo-using/

    Package Sidebar

    Install

    npm i mongo-using

    Weekly Downloads

    0

    Version

    1.0.1

    License

    ISC

    Unpacked Size

    3.45 kB

    Total Files

    6

    Last publish

    Collaborators

    • xcud