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

zangodb

v1.0.8

Published

MongoDB-like interface for HTML5 IndexedDB

Downloads

1,341

Readme

ZangoDB

ZangoDB is a MongoDB-like interface for HTML5 IndexedDB that supports most of the familiar filtering, projection, sorting, updating and aggregation features of MongoDB, for usage in the web browser.

Example

let db = new zango.Db('mydb', { people: ['age'] });
let people = db.collection('people');

let docs = [
    { name: 'Frank', age: 20 },
    { name: 'Thomas', age: 33 },
    { name: 'Todd', age: 33 },
    { name: 'John', age: 28 },
    { name: 'Peter', age: 33 },
    { name: 'George', age: 28 }
];

people.insert(docs).then(() => {
    return people.find({
        name: { $ne: 'John' },
        age: { $gt: 20 }
    }).group({
        _id: { age: '$age' },
        count: { $sum: 1 }
    }).project({
        _id: 0,
        age: '$_id.age'
    }).sort({
        age: -1
    }).forEach(doc => console.log('doc:', doc));
}).catch(error => console.error(error));

Which outputs:

doc: { count: 3, age: 33 }
doc: { count: 1, age: 28 }

Installation

ZangoDB is available as an npm package, and the web-browser build can be downloaded here or embedded:

<script src="https://unpkg.com/zangodb@latest/dist/zangodb.min.js"></script>

For certain web browsers, such as Internet Explorer, the Babel polyfill is required and must be loaded before ZangoDB:

<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.23.0/polyfill.min.js"></script>

ZangoDB then can be accessed using the global variable zango.

To install ZangoDB for usage with node:

$ npm install zangodb

In both cases, an implementation of IndexedDB is required. For environments without a native implementation of IndexedDB, Fake IndexedDB can be used:

global.indexedDB = require('fake-indexeddb');
global.IDBKeyRange = require('fake-indexeddb/lib/FDBKeyRange');

Document Language Operators

Filter Operators

The following filter operators are supported: $and, $or, $not, $nor, $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, $elemMatch, $regex, and $exists.

Expression Operators

Expression operators can be used in combination with the group and projection operators.

The following expression operators are supported: $literal, $add, $subtract, $multiply, $divide, $mod, $abs, $ceil, $floor, $ln, $log10, $pow, $sqrt, $trunc, $concat, $toLower, $toUpper, $concatArrays, $dayOfMonth, $year, $month, $hour, $minute, $second, and $millisecond.

Update Operators

The following update operators are supported: $set, $unset, $rename, $inc, $mul, $min, $max, $push, $pop, $pullAll, $pull, and $addToSet.

Group Operators

The following group operators are supported: $sum, $avg, $min, $max, $push, and $addToSet.

Aggregation Pipeline Stages

The following aggregation pipeline stages are supported: $match, $project, $group, $unwind, $sort, $skip, and $limit.

License

MIT, please view the LICENSE file.