Registry / database / zangodb

zangodb

JSON →
library1.0.8jsnpmunverified

ZangoDB (v1.0.8) provides a MongoDB-like query interface over HTML5 IndexedDB in the browser. It supports most MongoDB filter operators ($and, $or, $regex, $elemMatch), update operators ($set, $unset, $inc), aggregation pipeline stages ($match, $project, $group, $unwind, $sort), and group operators ($sum, $avg). Unlike other IndexedDB wrappers, ZangoDB offers a full query language with projection and aggregation, similar to Minimongo but more actively maintained. It is designed for browser use and requires an IndexedDB implementation (native or polyfill). Release cadence is low; the version 1.0.8 has been stable with no recent updates. It ships TypeScript definitions.

npm install zangodb
INSTALL
IMPORT
SIG · ZANGODB
Z
zangodb
databasejavascriptv1.0.8
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

zango
import { zango } from 'zangodb'
import zango from 'zangodb'
Named export 'zango' is the default; must import as named. In CommonJS: const { zango } = require('zangodb')
Db
const { Db } = require('zangodb')
const Db = require('zangodb').Db
Db is a property of the zango object; CommonJS destructuring is correct.
Collection
import { Collection } from 'zangodb'
import { collection } from 'zangodb'
The type is exported as 'Collection' (capital C).

Initializes a ZangoDB database, inserts documents, and queries with filter and sort, then logs results.

import { zango } from 'zangodb'; const db = new zango.Db('mydb', { people: ['age'] }); const people = db.collection('people'); await people.insertMany([ { name: 'Frank', age: 20 }, { name: 'Thomas', age: 33 }, { name: 'Todd', age: 33 }, { name: 'John', age: 28 }, { name: 'Peter', age: 33 }, { name: 'George', age: 28 } ]); const docs = await people.find({ age: { $gt: 20 } }) .sort({ age: -1 }) .toArray(); console.log(docs);
Debug
Known issues
breakingIndexedDB must be available globally. In Node.js, you must provide a polyfill (e.g., fake-indexeddb).
fix
const indexedDB = require('fake-indexeddb'); const IDBKeyRange = require('fake-indexeddb/lib/FDBKeyRange'); global.indexedDB = indexedDB; global.IDBKeyRange = IDBKeyRange;
affects: >=1.0.0
gotchaThe 'zango' object is the default export. It must be imported as a named import, not default.
fix
import { zango } from 'zangodb' instead of import zango from 'zangodb'
affects: >=1.0.0
deprecatedThe insert method returns a promise for the inserted document(s). The older callback style is deprecated.
fix
Use .then() or await, not callbacks.
affects: >=1.0.0
gotchaCollection indexes must be declared when creating the Db instance. Missing indexes on frequently queried fields can cause performance issues.
fix
new zango.Db('mydb', { people: ['age', 'name'] })
affects: >=1.0.0
gotchaThe aggregation pipeline stages are executed lazily; they return a cursor. You must call .toArray() or .forEach() to execute.
fix
Ensure to call .toArray() on aggregation pipelines.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: zango is not a constructor
Incorrect import: used default import instead of named import.
fix
import { zango } from 'zangodb'
TypeError: Cannot read property 'Db' of undefined
zango module not loaded properly in browser (missing script or global).
fix
Load script from unpkg: <script src='https://unpkg.com/zangodb@latest/dist/zangodb.min.js'></script>
TypeError: db.collection is not a function
db variable is not a valid ZangoDB Db instance, possibly due to IndexedDB not being defined.
fix
Ensure indexedDB global is polyfilled in Node.js or the browser supports IndexedDB.
TypeError: Cannot read properties of undefined (reading 'insert')
Collection variable is undefined because the collection name does not match the schema defined in Db constructor.
fix
db.collection('people') requires that 'people' was listed in the schema: new zango.Db('mydb', { people: ['age'] })
Upgrade
Version history
1.0.8latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
32 hits · last 30 days
node
27
OpenAI (training)
1
Resources
zangodb — npm install zangodb · libregistry