1.0.2 • Published 2 years ago

@bamiot/nedb-client v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

nedb-client

a very simple client for the nedb

IMPORTANT

nedb package has been replaced with a fork of the original package, nedb-promises to solve some vulnerability issues originating from nedb and use promises

Installation

npm install ---save @bamiot/nedb-client

Usage

create client-file for initilize database and export client.

// simple and compact usage, use all default options
const NedbClient = require('nedb-client')

module.exports = new NedbClient(['user'])
// options for client
const NedbClient = require('nedb-client')

const tables = ['user']

const options = {
  location: './db',
  disableFileExtension: true,
}

const dbClient = new NedbClient(tables, options)

module.exports = dbClient
// options for tables
const NedbClient = require('nedb-client')

const tables = {
  user: {
    autoload: true,
    persistent: true,
  },
  message: {},
}

const options = {
  location: './db',
  disableFileExtension: true,
  defaultAutoLoad: fasle,
  defaultPersistent: false,
}

const dbClient = new NedbClient(tables, options)

module.exports = dbClient

call client file

const dbClient = require('./[client-file]')

dbClient.db.user.insert({ name: 'bamiot' })
1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago