Home >Web Front-end >JS Tutorial >Introduction to LokiJS, an in-memory database implemented by JavaScript, and introductory examples_javascript skills
LokiJS is an in-memory database that puts performance considerations first.
LokiJS supports indexing and faster document access, and the execution performance is very good (nearly 500,000 OPS/second). Its built-in DynamicView class can be used to index subsets of data for even faster performance.
*Read this article to take a look at the performance of LokiJS.
LokiJS supports collections (datasets), much like MongoDB, and saves data to disk in JSON format, so your data is portable.
LokiJS can run on Node.js side and browser side.
JavaScript is an easy-to-learn, universal language, so database development in JavaScript is very easy and very efficient. If your MongoDB has not yet been retired, you may find LokiJS to be a more ideal solution in the following situations:
1. Mobile applications - especially HTML applications. (Cordova, Phonegap)
2. Node.js built-in data storage designed for small to medium-sized applications
3. Applications built into the desktop (Node Webkit)
LokiJS is supporting standalone servers, accessible using http/tcp clients.
Choose your favorite paradigm
The functionality of LokiJS fully harnesses the power of JavaScript.
If functional programming is your preferred style, then you'll definitely enjoy using views to query data.
You can also use your preferred MongoDB shell to query text objects.
Quick Start
Install
LokiJS can be installed in npm and bower. Run:
Use
Create database:
Input the JSON file you need to save the data
Create dataset:
Insert document:
Get documents:
Create dynamic view:
MapReduce (data aggregation):