{"id":19142436,"url":"https://github.com/eldoy/rundb","last_synced_at":"2025-10-06T14:32:40.262Z","repository":{"id":139868750,"uuid":"342476871","full_name":"eldoy/rundb","owner":"eldoy","description":"RunDB in-memory database with persistence for NodeJS.","archived":false,"fork":false,"pushed_at":"2021-02-28T01:57:16.000Z","size":109,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-03T15:28:02.013Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eldoy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-26T05:49:31.000Z","updated_at":"2022-06-04T21:52:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"a06f2696-cd75-4069-8964-c1de0359d1aa","html_url":"https://github.com/eldoy/rundb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Frundb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Frundb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Frundb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Frundb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eldoy","download_url":"https://codeload.github.com/eldoy/rundb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240223531,"owners_count":19767618,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T07:27:16.598Z","updated_at":"2025-10-06T14:32:40.201Z","avatar_url":"https://github.com/eldoy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RunDB\n\nRunDB in-memory database with persistence for NodeJS. Fast database for small to medium size data sets.\n\nBased on [NeDB](https://github.com/louischatriot/nedb) and follows the [Waveorb database adapter spec.](https://github.com/eldoy/waveorb-db)\n\n### Install\n`npm i rundb`\n\n### Usage\n**Connect to database**\n```js\nconst connection = require('rundb')\nconst db = await connection()\n```\n\n**Create document**\n```js\n// Returns the created id: { id: '507f191e810c19729de860ea' }\n// Takes only 1 argument: values\nconst result = await db('project').create({ name: 'hello' })\n```\n\n**Create multiple documents**\n```js\n// Returns the the created count and the created ids:\n// { n: 2, ids: ['507f191e810c19729de860ea', '607f191e810c19729de860eb'] }\n// Takes only 1 argument: values, must be array of objects\nconst result = await db('project').create([{ name: 'hello' }, { name: 'bye' }])\n```\n\n**Update document (updates multiple if query matches)**\n```js\n// Returns the number of updated documents: { n: 1 }\n// Takes 2 arguments: query, values\nconst result = await db('project').update({ id: '507f191e810c19729de860ea' }, { name: 'bye' })\n```\n\n**Delete document (deletes multiple if query matches)**\n```js\n// Returns the number of deleted documents: { n: 1 }\n// Takes 1 argument: query\nconst result = await db('project').delete({ id: '507f191e810c19729de860ea' })\n```\n\n**Find document**\n```js\n// Returns an array of matching documents\n// Takes 2 arguments: query, options\n\n// Find all\nconst result = await db('project').find()\n\n// Find all with name 'bye'\nconst result = await db('project').find({ name: 'bye' })\n\n// Find with sorting on 'name' field descending, use 1 for ascending\nconst result = await db('project').find({}, { sort: { name: -1 } })\n\n// Find only 2\nconst result = await db('project').find({}, { limit: 2 })\n\n// Find but skip 2\nconst result = await db('project').find({}, { skip: 2 })\n\n// Find all but don't include the 'name' field in the result\nconst result = await db('project').find({}, { fields: { name: false } })\n\n// Find all with 'level' field greater than 5\nconst result = await db('project').find({ level: { $gt: 5 }})\n```\nAll of the [mongodb query operators](https://docs.mongodb.com/manual/reference/operator/query/) should work.\n\n**Get document**\n```js\n// Returns the first matching document\n// Takes 2 arguments: query, options\nconst result = await db('project').get({ name: 'bye' })\n```\n\n**Count documents**\n```js\n// Returns the count of the matching query\n// Takes 2 arguments: query, options\nconst result = await db('project').count({ name: 'bye' })\n```\n\n**The database client**\n```js\ndb.client\n```\n\nMIT Licensed. Enjoy!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldoy%2Frundb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feldoy%2Frundb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldoy%2Frundb/lists"}