@yevheni/mangodb

0.0.17 • Public • Published

MangoDB

Simple MongoDB wrapper based on mongoose and shortid

Installation

npm install --save @yevheni/mangodb

Usage

const MangoDB = require("@yevheni/mangodb").MangoDB;
// or
import {MangoDB} from "@yevheni/mangodb";

const mango = new MangoDB("mongodb://localhost:27017/mango", {
    useNewUrlParser: true
});
mango.collection("test").create({
    test: true
}).then(test => {
    // do something
}).catch(err => console.error(err));

Reference

new MangoDB(url, options)

  • url: String

    MongoDB connection url (see mongoose docs)

  • options: Object

    MongoDB connection options (see mongoose docs)

collection(name)

  • name: String

    Collection name. Returns Mongoose Model

drop()

Drops database. Returns Promise and resolves after drop success

connection

Returns Mongoose Connection

Package Sidebar

Install

npm i @yevheni/mangodb

Weekly Downloads

3

Version

0.0.17

License

Apache-2.0

Unpacked Size

169 kB

Total Files

13

Last publish

Collaborators

  • yevheni