CamaDB is an embedded NoSQL database written in pure TypeScript, supporting Node.js, Electron, and browser environments. Its current stable version is 2.0.0 (January 2023), and it is under active development. CamaDB provides a MongoDB-style API for querying (SiftJS), updating (Obop), and aggregation (Mingo, with some limitations), offering full TypeScript support. It differentiates itself by providing frictionless integration across runtimes, handling native JavaScript data types, and aiming for fast performance on datasets up to 1 million rows, bypassing common issues with native database bindings in environments like Electron.
npm install camadbVerified import paths — ran on the pinned version, not inferred.
Demonstrates initializing a CamaDB instance and a collection with a type interface, then inserting a document, and performing basic find and update operations.
Review any custom logic interacting with CamaDB's internal operation queues or persistence layer if upgrading from versions prior to 2.0.0. Ensure compatibility with the new centralized system.
Optimize queries by using precise filters to reduce the dataset size that needs to be scanned. For critical performance, consider implementing application-level caching or pre-processing data.
Integrate a third-party full-text search library (e.g., FlexSearch, Lunr.js) or develop a custom keyword-matching solution for your data.
Refactor complex aggregation queries that would typically use '$lookup' into multiple `find` operations, then join and process the results within your application code.
Ensure `import "reflect-metadata";` is present at the very top of your application's entry file. Additionally, `emitDecoratorMetadata` and `experimentalDecorators` must be set to `true` in your `tsconfig.json`.
Add `import "reflect-metadata";` at the top of your main application entry file. Also, ensure `emitDecoratorMetadata` and `experimentalDecorators` are `true` in your `tsconfig.json`.
Configure the `persistenceAdapter` option during `Cama` initialization to match your target environment: use `'fs'` for Node.js/Electron, and `'indexeddb'` or `'localstorage'` for browser-based applications.
When initializing a collection via `database.initCollection`, ensure that any columns intended to store `Date` objects have `type: 'date'` specified in their column definition, e.g., `{ type: 'date', title: 'myDateColumn' }`.Ensure `database.initCollection()` is called only once per collection name per database instance. Store the returned `Collection` instance and reuse it throughout your application.