{"library":"marsdb","title":"MarsDB Client-Side Database","description":"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.","language":"javascript","status":"maintenance","last_verified":"Thu Apr 23","install":{"commands":["npm install marsdb"],"cli":null},"imports":["import Collection from 'marsdb';","import 'marsdb/polyfills';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import Collection from 'marsdb';\n\nasync function runMarsDBExample() {\n  // Create a new collection named 'users'\n  const users = new Collection('users');\n\n  // Clear existing data for a clean run\n  await users.remove({});\n\n  // Insert documents\n  const insertResult = await users.insert([\n    { _id: '1', name: 'Alice', age: 30, city: 'New York' },\n    { _id: '2', name: 'Bob', age: 24, city: 'Los Angeles' },\n    { _id: '3', name: 'Charlie', age: 30, city: 'Chicago' },\n    { _id: '4', name: 'Diana', age: 28, city: 'New York' }\n  ]);\n  console.log(`Inserted ${insertResult.length} users.`);\n\n  // Find users aged 30\n  const agedThirty = await users.find({ age: 30 }).fetch();\n  console.log('Users aged 30:', agedThirty);\n\n  // Find users in New York, sorted by name\n  const nyUsers = await users.find({ city: 'New York' })\n    .sort({ name: 1 })\n    .fetch();\n  console.log('Users in New York (sorted):', nyUsers);\n\n  // Update Alice's age\n  await users.update({ name: 'Alice' }, { $set: { age: 31 } });\n  const updatedAlice = await users.findOne({ name: 'Alice' });\n  console.log('Updated Alice:', updatedAlice);\n\n  // In a real application, observable cursors would react to changes.\n  // For a quickstart, we just fetch all current users.\n  const allUsers = await users.find({}).fetch();\n  console.log('All current users:', allUsers);\n}\n\nrunMarsDBExample().catch(console.error);","lang":"javascript","description":"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}