
Memoz
Memoz is an in-memory database that persists on disk. The data model is key-value, but many different kind of values are supported: Strings, Lists, Sets, Sorted Sets, Hashes, Streams, HyperLogLogs, Bitmaps.
Installation
npm i memoz
// or
yarn add memoz
Usage
const Memoz = require('memoz')
// Or
import Memoz from 'memoz'
Methods
create
This method takes two parameters:
key, this is astringvalue, this is anany, maybestring,number,object,arrayany valid data types in javascript
const memoz = new Memoz()
const person = memoz.create('name', 'john')
// {id: 'sdfd-dsfg455-dfg544fg', name: 'john'}
updateMany
This method takes two parameters:
query, this is aobjectcontains keys and values, it will beAND, this isrequirednewData, this is anany, maybestring,number,object,arrayany valid data types in javascript, this isrequired
const memoz = new Memoz()
const person = memoz.updateMany('name', 'Milad')
// { updated: true }
updateOne
This method takes two parameters:
query, this is aobjectcontains keys and values, it will beAND, this isrequirednewData, this is anany, maybestring,number,object,arrayany valid data types in javascript, this isrequired
const memoz = new Memoz()
const person = memoz.updateOne('name', 'Milad')
// {id: 'sdfd-dsfg455-dfg544fg', name: 'Milad'}
get
This method take one parameters:
query, this is a object contains keys and values, it will be AND, this is optional
const memoz = new Memoz()
const person = memoz.get({ name: 'Milad' })
// [{id: 'sdfd-dsfg455-dfg544fg', name: 'Milad'}]
getOne
This method take one parameters:
query, this is a object contains keys and values, it will be AND, this is required
const memoz = new Memoz()
const person = memoz.getOne({ name: 'Milad' })
// {id: 'sdfd-dsfg455-dfg544fg', name: 'Milad'}
deleteMany
This method take one parameters:
query, this is a object contains keys and values, it will be AND, this is required
const memoz = new Memoz()
const person = memoz.deleteMany({ name: 'Milad' })
// {deleted: true, number: 5}
deleteOne
This method take one parameters:
query, this is a object contains keys and values, it will be AND, this is required
const memoz = new Memoz()
const person = memoz.deleteOne({ name: 'Milad' })
// {deleted: { id: "dslkmds68-dfgh45", name: "Milad" }}
Related articles
Encrypt By RSA Algorithm
RSA is a public-key cryptosystem that is widely used for secure data transmission. It is also one of the oldest. The acronym RSA comes from the surnames of Ron Rivest.
De Duplicated
This is package for deleting the duplicated elements in array, there are contain two methods, first method called simpleArray, this method deduplicated the…
Error Handler E2
[](https://travis-ci.org/miladezzat/error-handler-e2) [](https://badge.fury.io/js/error-handler-e2)