BrowserStorageDB give you posibility to save and find data in localStorage or sessionStorage with basic mongoDB interface.
set(documents: [Object]): void
import BrowserStorageDB from 'browser-storage-db';
const db = new BrowserStorageDB('testDB', localStorage);
const initialState = [{ id:'1', name:'foo', desc: 'bar' }, { id:'2', name:'foo2', desc: 'bar2' }];
db.set(initialState);
insert(document: Object): String
import BrowserStorageDB from 'browser-storage-db';
const db = new BrowserStorageDB('testDB', localStorage);
const document = { name:'foo', desc: 'bar' };
const documentId = db.insert(document);
update(id: String, data: Object): void
import BrowserStorageDB from 'browser-storage-db';
const db = new BrowserStorageDB('testDB', localStorage);
const documentId = '3d3d4sda3sd';
const document = { name:'foo2', desc: 'bar2' };
db.update(documentId, document);
find(query: Object): [Object]
import BrowserStorageDB from 'browser-storage-db';
const db = new BrowserStorageDB('testDB', localStorage);
const query = { name: 'foo2' };
const documents = db.find(query);
findOne(query: Object): Object
import BrowserStorageDB from 'browser-storage-db';
const db = new BrowserStorageDB('testDB', localStorage);
const query = { name: 'foo2' };
const document = db.findOne(query);
To see more complex examples, check out this project's test suite.