RepositoryJavaScriptHUHungary
BA

bajankristof/nedb-promises

A dead-simple promise wrapper for nedb.

299stars
44forks
0issues
4views

nedb-promises

A dead-simple promise wrapper for nedb.

Check out the docs.

IMPORTANT

As of nedb-promises 5.0.0 nedb package has been replaced with a fork of the original package, @seald-io/nedb to solve some vulnerability issues originating from nedb!

const Datastore = require('nedb-promises')
let datastore = Datastore.create('/path/to/db.db')

// #1
datastore.find({ field: true })
  .then(...)
  .catch(...)
  
// #2
datastore.find({ field: true })
  .exec(...)
  .then(...)
  .catch(...)

// #1 and #2 are equivalent

datastore.findOne({ field: true })
  .then(...)
  .catch(...)
  
datastore.insert({ doc: 'yourdoc' })
  .then(...)
  .catch(...)
  
// or in an async function
async function findSorted(page, perPage = 10) {
  return await datastore.find(...)
      .sort(...)
        .limit(perPage)
        .skip(page * perPage)
}

Installation

npm install --save nedb-promises

Usage

Everything works as the original module, with a couple of exceptions:

  • There are no callbacks.
  • loadDatabase has been renamed to load.
  • The cursor's projection method has been renamed to project.
  • You should call Datastore.create(...) instead of new Datastore(...). This way you can access the original nedb properties, such as datastore.persistence.
  • As of v2.0.0 the module supports events 😎... Check out the docs about events!

Check out the original docs!

load( )

You don't need to call this as the module will automatically detect if the datastore has been loaded or not upon calling any other method.

const Datastore = require('nedb-promises')
let datastore = Datastore.create('/path/to/db.db')
datastore.load(...)
  .then(...)
  .catch(...)

find( [query], [projection] ), findOne( [query], [projection] ), count( [query] )

These methods will return a Cursor object that works the same way it did before except when you call "exec" it takes no arguments and returns a Promise. The cool thing about this implementation of the Cursor is that it behaves like a Promise. Meaning that you can await it and you can call .then() on it.

const Datastore = require('nedb-promises')
let datastore = Datastore.create('/path/to/db.db')

//outside Promise chain
datastore.find(...)
  .then(...)
  .catch(...)
  
//insinde Promise chain
datastore.insert(...)
  .then(() => {
    return datastore.find(...)
  })
  .then(
    // use the retrieved documents
  )

;(async () => {
  await datastore.find(...).sort(...).limit()
})()

other( ... )

All the other methods will take the same arguments as they did before (except the callback) and will return a Promise.

Check out the docs.

Similar Projects

Discover other similar projects and AI models.

RepositoryTypeScript
adamreisnz/replace-in-file

A simple utility to quickly replace contents in one or more files

617
Oct 10, 2026
RepositoryJavaScript
Leonxlnx/taste-skill

Agent skills that give coding agents taste: art direction, reference images and a browser check instead of generic AI pages

124.6k
Nov 26, 2026
RepositoryJavaScript
addyosmani/agent-skills

Production-grade engineering skills for AI coding agents.

122.0k
Nov 24, 2026
RepositoryJavaScript
trekhleb/javascript-algorithms

📝 Algorithms and data structures implemented in JavaScript with explanations and links to further readings

196.8k
Jul 26, 2026
Repository
x1xhlol/system-prompts-and-models-of-ai-tools

FULL Augment Code, Claude Code, Cluely, CodeBuddy, Comet, Cursor, Devin AI, Junie, Kiro, Leap.new, Lovable, Manus, NotionAI, Orchids.app, Perplexity, Poke, Qoder, Replit, Same.dev, Trae, Traycer AI, VSCode Agent, Warp.dev, Windsurf, Xcode, Z.ai Code, Dia & v0. (And other Open Sourced) System Prompts, Internal Tools & AI Models

145.0k
Oct 12, 2026
RepositoryPython
Panniantong/Agent-Reach

Give your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.

116.7k
Nov 24, 2026
RepositoryGo
netdata/netdata

Full-stack observability · Metrics · Logs · Traces · Flows · Topology · Infrastructure · APM · NPM · DBM · RUM · Synthetics · Cloud · AI SRE · OpenTelemetry · SNMP · NetFlow/IPFIX/sFlow · IPMI · Redfish · 2000+ integrations

81.7k
Nov 30, 2026
RepositoryC
redis/redis

For developers, who are building real-time data-driven applications, Redis is the preferred, fastest, and most feature-rich cache, data structure server, and document and vector query engine.

77.9k
Dec 1, 2026
RepositoryRust
meilisearch/meilisearch

A lightning-fast search engine API bringing AI-powered hybrid search to your sites and applications.

60.1k
Dec 1, 2026