GitHub - kutluturk/memdb-json: Very fast in memory object DB for Node.JS.
source link: https://github.com/kutluturk/memdb-json
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
In-Memory Database For JSON Objects that can be queried like SQL
This package is intended to be used as a drop-in small footprint Object database solution for Node.JS.
How to Install
npm install --save memdb-json
Usage
This package is still in alpha stage. Please be aware before using in production environment.
Initialization
const memdb = require('memdb-json'); const MemDB = new memdb(pathToFile); //path to optional JSON file
You can pass an optional JSON file path to the function for persistant data storage.
Insert an object to the DB
MemDB.insert({id: 1, Name: "Halil", Surname: "Kutluturk", Age: 45, City: "Berlin", Country: "Germany"});
Returns a UUID of the object inserted to the DB
Select object(s) from the DB
MemDB.select({where: {City: "Berlin"}}); MemDB.select({where: {Surname: "Smith", Age: 45}}); // You can add multiple keywords MemDB.select(); //Returns all objects
You can query the DB with "where" keyword.
Returns an array of JSON Objects
Update an Object in the DB
MemDB.update({where: {id: 1}, set: {Born: "New York", Surname: "John", Born: "1998-01-01"}}); MemDB.update({where: {Name: "John", Surname: "Smith", Nationality: "USA"}, set: {Born: "New York", Active: true}});
Returns a JSON array with updated Objects
Delete object(s) from the DB
MemDB.delete({where: {id: 1}})
Empty (truncate) the DB
MemDB.truncate();
Save the Objects in the DB to a JSON file (persistant data storage)
MemDB.save(pathToFile);
Recommend
-
40
Last year we did a blog post on interservice auth. This post is mostly about authenticating consumers to an API. That’s a related but subtly different problem: you can probably impose more requirements on your internal use...
-
15
Sorting the Keys of a Python JSON Object Jun 11, 2020 I recently had to look at a complex JSON structure in Python....
-
7
How to load JSON from a variable, from an object advertisements I have this code: var browserName = "chrome"; function get...
-
19
Link the JSON object to the radio button in angularjs advertisements So I am trying to bind radio buttons to objects. I have spent like an hou...
-
6
How to access nested json object with nested ng-repeat in AngularJs Satinder Singh / June 20, 2021 /
-
6
JSON data Object Uses and Example using JavaScriptThe JSON(JavaScript Object Notation) is a prominent shared data format for information sharing among two or several applications. It provides the easy usage of storage and dat...
-
12
How to get the JSON iterate object and the JSON array using JavaScript. For each advertisements I have the following JSON object:
-
6
在线将JS/JavaScript-Object转JSON工具在线将JS/JavaScript-Object转JSON工具本工具可以将JSON对象转换成Go,支持复制和下载.
-
2
Meet Internet Object Specifically designed for transferring data over internet, Internet Object is a new age serialization/data-interchange format. It is human readable, thin, self explanatory, r...
-
3
Fast-Object Fast object creator, via transforming to JSON.parse(), but type safe.
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK