Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sean-nicholas/nedb-database

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sean-nicholas/nedb-database

Simple typescript & class support for NeDB

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

NeDB Database

A simple wrapper for some of the nedb functionality. It puts nedb into a class and adds typescript types.

Usage

Create a new database via:

const db = new Database<YourEntityType>({
  filename: 'path/to/nedb-file'
})

Initialization

To init your db just provide an array with a query and the corresponding value that should be added to the database. The init function checks if the value exists in the db and creates it otherwise.

await db.init([
  {
    query: { key: 'myConfig' },
    value: {
      key: { key: 'myConfig' },
      value: 'here it is'
    }
  }
])

Querying, Inserting & Co.

It is basically the same syntax as nedb but with promises:

const entry = await db.findOne({ key: 'myConfig' })

await db.update({ key: 'myConfig' }, {
    key: 'myConfig'
    value: 'new value'
  })

Supported methods are: insert, find, fineOne, count, update, remove. Cursor operations are not supported.

FAQs

Package last updated on 08 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc