NDDB (N-Dimensional DataBase) is a 100% JavaScript object database designed for both Node.js and browser environments. It offers a comprehensive set of features including indexing, views, hashes, joins, group-by operations, and various statistical functions (count, max, min, mean, stddev). The library supports saving and loading data from the file system (Node.js) and browser localStorage. Current stable version is 3.0.2, published approximately four years ago, suggesting a mature codebase in maintenance mode. Its key differentiators include a flexible API for complex data manipulation, support for cyclic objects, and a focus on developer-friendliness, making it suitable for applications requiring in-memory data management with advanced querying capabilities, such as simulations or interactive data visualizations.
npm install NDDBVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize NDDB, insert individual and multiple records, query the database using basic and advanced operators, and chain selection methods.
Replace `let db = new NDDB();` with `let db = NDDB.db();`.
In Node.js, use `const NDDB = require('NDDB');`. If ESM is strictly required, consider a CommonJS wrapper or a build tool that handles module interoperability.Ensure you are using a 'build/' directory version of `nddb.js` that includes `JSUS`, or include `JSUS` separately before `nddb.js` in your HTML `<script>` tags.
Exercise caution when using in projects targeting very recent Node.js versions. Consider thorough testing or evaluating alternatives if encountering unexpected behavior.
For browsers, ensure the NDDB script is loaded via a `<script>` tag and access `NDDB` globally. For Node.js ES module environments, either switch to CommonJS or use dynamic `import()` if NDDB provided ESM exports (which it typically doesn't directly).
Verify the `<script>` tag path in HTML or the `require()` path in Node.js. Check the console for script loading errors. If using ES modules in Node.js, ensure `const NDDB = require('NDDB');` is used instead of `import`.Ensure `const NDDB = require('NDDB');` is the primary import. If using a legacy setup, verify `NDDB` points to the correct top-level constructor/factory.Always check the result of selection methods before chaining further operations, e.g., `let selected = db.select('key', '=', 'value'); if (selected.size() > 0) { console.log(selected.first()); }`.No dependency data recorded yet.