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 🙏

© 2026 – Pkg Stats / Ryan Hefner

nedb-active-record

v0.1.11

Published

Simple realization of ActiveRecord pattern for NeDB

Readme

nedb-active-record

Simple realization of ActiveRecord pattern for NeDB

Installation

Through NPM:

npm install nedb-active-record

Code Example

ActiveRecord = require('nedb-active-record');

/*
    Global configuration for all instances.
    This is initial parameters for NeDB.
    Also was added two additional params:
    - location (internal folder), by default 'database',
    - format (e.c. 'db', 'txt')
*/
ActiveRecord.config({
    timestampData: true,
    autoload: true
});

//Creation of new collection (will create new file '/database/users.txt')
var User = new ActiveRecord('users');

//Create new user record.
var user = new User();
user.name = 'John';
user.age = 31;
user.save();

user.surname = 'Smith';
user.save();

//You can add parameters to constructor.
var user2 = new User({
    name: 'Rocky',
    surname: 'Balboa',
    age: 69
});

user2.save();

/*
    You can find data like in NeDB, unfortunately without chaining.
    Instead uses: $$sort, $$limit, $$skip, $$projection.
*/
User.find({age: {$gt: 23}, $$sort: {name: 1}})
    .then(function(users) {
        //users -> collection of User instances

        //Return new user record
        return User.insert({_id: 1, name: 'Bohdan'});
    })
    .then(function(newUser){
        newUser.citizenship = 'Ukrainian';
        newUser.save();
    })
    .then(function(){
        return User.findOne({_id:1}).then(function(foundUser){
            //Removing
            return foundUser.remove();
        });
    })
    .then(function(numRemoved) {
        console.log(numRemoved)
    })
    .catch(function(error){
        console.log(error);
    });