@touno-io/db

3.2.3 • Public • Published

@touno-io/db

mongodb simple connection

Environment

MONGODB_SERVER = 'localhost:27017'
// Or
MONGODB_URI = 'mongodb://localhost:27017'

Installation

npm i @touno-io/db
// or
yarn i @touno-io/db

sample

import mongo from '@touno.io/db'
const db = mongo()
// or
const db = require('@touno.io/db')()

db.set('TableName1', 'table_name1', { data: String })

await db.open('database_name')

db.set({
  id: 'TableName2',
  name: 'table_name2',
  schema: {
    data: String
  }
})

const { TableName1 } = db.get()
// or 
const TableName1 = db.get('TableName1')

let { data } = await TableName1.findOne({})

await db.close()

License

MIT © 2018 Touno™

Package Sidebar

Install

npm i @touno-io/db

Weekly Downloads

0

Version

3.2.3

License

MIT

Unpacked Size

32.9 kB

Total Files

31

Last publish

Collaborators

  • dvgamer