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

@seald-io/nedb

Package Overview
Dependencies
Maintainers
3
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@seald-io/nedb

File-based embedded data store for node.js

  • 3.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created

What is @seald-io/nedb?

@seald-io/nedb is a lightweight, embedded, and persistent database for Node.js applications. It is designed to be a simple and efficient solution for small to medium-sized applications that need a database without the overhead of a full-fledged database management system.

What are @seald-io/nedb's main functionalities?

Inserting Documents

This feature allows you to insert documents into the database. The `insert` method takes a document object and a callback function that handles the result of the insertion.

const Datastore = require('@seald-io/nedb');
const db = new Datastore({ filename: 'path/to/datafile', autoload: true });

const doc = { name: 'Alice', age: 25, city: 'Wonderland' };
db.insert(doc, function (err, newDoc) {
  if (err) console.error(err);
  else console.log('Inserted:', newDoc);
});

Finding Documents

This feature allows you to query the database for documents that match a given criteria. The `find` method takes a query object and a callback function that handles the result of the query.

db.find({ age: 25 }, function (err, docs) {
  if (err) console.error(err);
  else console.log('Found:', docs);
});

Updating Documents

This feature allows you to update documents in the database. The `update` method takes a query object, an update object, options, and a callback function that handles the result of the update.

db.update({ name: 'Alice' }, { $set: { age: 26 } }, {}, function (err, numReplaced) {
  if (err) console.error(err);
  else console.log('Updated:', numReplaced);
});

Removing Documents

This feature allows you to remove documents from the database. The `remove` method takes a query object, options, and a callback function that handles the result of the removal.

db.remove({ name: 'Alice' }, {}, function (err, numRemoved) {
  if (err) console.error(err);
  else console.log('Removed:', numRemoved);
});

Other packages similar to @seald-io/nedb

Keywords

FAQs

Package last updated on 16 Mar 2022

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