MarsDB is a lightweight client-side database inspired by Meteor's minimongo implementation, providing a MongoDB-like API for JavaScript environments. It offers a Promise-based interface, observable cursors, and reactive joins, making it well-suited for applications requiring real-time data reactivity. Written in ES6, it operates across various JavaScript platforms including browsers, Electron, NW.js, and Node.js. The current stable version is 0.6.11. The project appears to be in a maintenance phase, with recent activity primarily focused on bug fixes rather than significant new feature development. Its key differentiators include a flexible pluggable storage architecture (supporting in-memory, LocalStorage, LevelUP, and even MongoDB wrappers), a powerful pipeline for data transformation, and compatibility with a wide range of MongoDB query and modifier operations.
npm install marsdbVerified import paths — ran on the pinned version, not inferred.
Demonstrates creating a MarsDB collection, inserting multiple documents, performing find operations with filters and sorting, and updating a document, all using the Promise-based API.
Remove usages of `static` and `method`. Direct object manipulation is now standard. Adjust code that relied on `Document` wrapping.
To retrieve the actual value, you must now call `.fetch()` on the result, e.g., `await users.find({}).count().fetch()`.Install the specific plugin packages you need (e.g., `npm install marsdb-levelup`) and import them separately from `marsdb`.
Ensure the cursor is not executing by awaiting its `whenNotExecuting()` method before applying changes: `await cursor.whenNotExecuting(); cursor.sort({ name: 1 });`Add `import 'marsdb/polyfills';` (ESM) or `require('marsdb/polyfills');` (CommonJS) at the entry point of your application, before any MarsDB usage.Add `import 'marsdb/polyfills';` or `require('marsdb/polyfills');` at the top of your main application file to ensure Promises are available.Chain `.fetch()` to the `count()` call to retrieve the actual number: `await users.find({}).count().fetch()`.Use the `whenNotExecuting()` method to safely queue changes: `await cursor.whenNotExecuting(); cursor.sort({ name: 1 });`Install the specific storage plugin (e.g., `npm install marsdb-localforage`) and import it separately, then apply it to your collection: `import LocalForageManager from 'marsdb-localforage'; const users = new Collection('users', { StorageManager: LocalForageManager });`No dependency data recorded yet.