{"id":25405178,"url":"https://github.com/instapp/storagedb","last_synced_at":"2025-10-31T00:31:43.923Z","repository":{"id":57371259,"uuid":"103736532","full_name":"instapp/storagedb","owner":"instapp","description":"MongoDB-like API for HTML5 Storage (localStorage and sessionStorage)","archived":false,"fork":false,"pushed_at":"2019-05-07T18:00:53.000Z","size":48,"stargazers_count":17,"open_issues_count":4,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-31T09:42:22.549Z","etag":null,"topics":["library","localstorage","sessionstorage","storagedb"],"latest_commit_sha":null,"homepage":"https://instapp.github.io/storagedb","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/instapp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-16T08:10:57.000Z","updated_at":"2020-11-06T04:20:52.000Z","dependencies_parsed_at":"2022-09-26T16:41:14.325Z","dependency_job_id":null,"html_url":"https://github.com/instapp/storagedb","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/instapp%2Fstoragedb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/instapp%2Fstoragedb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/instapp%2Fstoragedb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/instapp%2Fstoragedb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/instapp","download_url":"https://codeload.github.com/instapp/storagedb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239088392,"owners_count":19579432,"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":["library","localstorage","sessionstorage","storagedb"],"created_at":"2025-02-16T04:30:49.235Z","updated_at":"2025-10-31T00:31:43.595Z","avatar_url":"https://github.com/instapp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# StorageDB\n\n[![npm](https://badge.fury.io/js/storagedb2.svg)](https://www.npmjs.com/package/storagedb2)\n[![license](https://img.shields.io/npm/l/storagedb2.svg)](https://github.com/instapp/storagedb)\n\nMongoDB-like API for HTML5 Storage (localStorage and sessionStorage)\n\n\u003e ***NOTICE***: The npm package name is '**storagedb2**'\n\n## Features\n\n- MongoDB-like API\n- Lightweight, only ***3KB*** (minified and gzipped)\n- No dependencies\n- Easy configuration\n- Well-supported query selectors (`$gt`,`$in`, ...) and options (`skip`, `limit`, `sort`)\n- Automatically cache in memory\n\n## Getting started\n\n### Install\n\n```bash\nnpm install --save storagedb2\n```\n\nImport storagedb to your project (ES6)\n```js\nimport StorageDB from 'storagedb2'\n```\n\nOr add the script to your main HTML file\n```html\n\u003cscript src=\"./lib/storagedb.js\"\u003e\u003c/script\u003e\n```\n\n### Collection Supported methods\n\n- [insert](#insert) `(docs)`\n- [remove](#remove) `(query)`\n- [update](#update) `(query, values, options)`\n- [find](#find) `(query, options)`\n- [findOne](#findOne) `(query, options)`\n- [drop](#drop) `()`\n\n## Usage\n\n### Instantiate\n\n```js\nconst db = new StorageDB({\n    storage: window.localStorage,     // storage object, default is window.localStorage. If you want to store data in memory only, you can set it null\n    database: 'testdb',               // database name, default is 'db'\n    primaryKey: 'id'                  // primary key of collection, default is '_id'\n})\n\n// create collection (table) instance\nconst Users = db.get('users')\n```\n\n### insert\n\n```js\nUsers.insert({\n    id: 100,\n    name: 'Elon',\n    age: 12\n})\n\nUsers.insert([{\n    id: 101,\n    name: 'Larry',\n    age: 21\n}, {\n    id: 102,\n    name: 'Sergey',\n    age: 21\n}])\n```\n\n### find\n\n```js\nUsers.find([100, 102])\n\nUsers.find({\n    name: /y$/,\n    age: {\n        $gte: 20\n    }\n}, {\n    skip: 0,\n    limit: 20,\n    sort: {\n        age: 1\n    }\n})\n```\n\n### find\n```js\nUsers.findOne(102)\n\nUsers.findOne({\n    age: {\n        $ne: 21\n    }\n})\n```\n\n### update\n```js\nUsers.update(100, {\n    age: 47,\n    company: 'The Avengers'\n})\n\nUsers.update({\n    age: 21\n}, {\n    age: 22\n}, {\n    multi: true\n})\n```\n\n### remove\n```js\nUsers.remove(101)\n\nUsers.remove({\n    age: 21\n})\n```\n\n### drop\n```js\nUsers.drop()\n```\n\n## License\n\n[MIT](http://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finstapp%2Fstoragedb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finstapp%2Fstoragedb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finstapp%2Fstoragedb/lists"}