npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@deonis/ndb

v1.0.5

Published

nedb: https://github.com/louischatriot/nedb

Downloads

12

Readme

NDB wrapper for NEDB:

nedb: https://github.com/louischatriot/nedb

Installation

wget https://github.com/deonis1/ndb

unzip ndb; cd ndb; npm install

Via NPM:

npm install https://github.com/deonis1/ndb

Usage

NDB contains the following functions which are similar to the mongodb api: insertOne, insertMany, find, findOne, deleteOne, deleteMany, updateOne, updateMany

Loading the module

const ndb = require("ndb");

Initializing the module

var db = new ndb();

Insert one item into the collection

db.insertOne(collection, {x:i, y:i+i, z:i*i})

Insert multiple items in collection

db.insertMany(collection, Array(5).fill({x:1, y:2, z:3}))

Find all items in the collection

db.find(collection, {})

Find one item in the collection

db.findOne(collection, {x:1, y:2, z:3})

Delete one item from the collection

db.deleteOne(collection, {x:1, y:2, z:3})

Delete many item in the collection

db.deleteMany(collection, {x:1, y:2, z:3})

Update one item in the collection

db.updateOne(collection, {x:1, y:2, z:3}, {x:4, y:5, z:6})

Update many item in the collection

db.updateMany(collection, {x:1, y:2, z:3}, {x:4, y:5, z:6})

Examples

async function test(){

var db = new ndb();
const collection = "testrun"+Math.random().toString();
console.log("insertOne 20 times");
for (let i = 0; i <20; i++){
    db.insertOne(collection, {x:i, y:i+i, z:i*i})
}
console.log("insertMany [5X{x:1, y:2, z:3}]");
db.insertMany(collection,  Array(5).fill({x:1, y:2, z:3}));

console.log("find all");
console.log(await db.find(collection, {}));   

console.log("Find one {x:1, y:2, z:3}");
console.log(await db.findOne(collection, {x:1, y:2, z:3}));

console.log("deleteOne {x:1, y:2, z:3}");
db.deleteOne(collection, {x:1, y:2, z:3});

console.log("Find 4 items remaining {x:1, y:2, z:3}");
console.log(await db.find(collection, {x:1, y:2, z:3}));

console.log("updateOne item {x:1, y:2, z:3} to {x:4, y:5, z:6}");   
db.updateOne(collection, {x:1, y:2, z:3}, {x:4, y:5, z:6});

console.log("Find updated item  {x:4, y:5, z:6}");
console.log(await db.find(collection,  {x:4, y:5, z:6}));

}