MangoDB
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