LokiJS - A JavaScript Database
Written by Kay Ewbank   
Tuesday, 18 November 2014

LokiJS, a lightweight JavaScript document-oriented database has reached version 1.0. An in-memory database, it prioritises performance.




LokiJS supports field indexing for faster document access and performs at near 500,000 ops/s on those. Its built-in DynamicView class also enables to utilize indexes on data subsets for even faster performance.  



The main advantage for LokiJS is a combination of the very small size (14.66KB when unzipped) and the fast performance.

Recent benchmarks indicate that its primary get() operation is about 1.4 million operations per second on a mid-range Core i5 running under node.js. The get() operation utilizes an auto generated 'id' column with its own auto generated binary index. If you’re running a Mongo-style query object, you’ll get around 20,000 ops per second under node.js, or around 500,000 ops per second if you’re querying an indexed field.

LokiJS is designed to be used for in-memory datasets, though it does persist data between sessions, and will persist data to disk when changes are made in a nodeJS, node-webkit and environments. When you want to persist data between sessions, the entire database state can be serialized as a single entity, so you can restore the state or transfer it across environments as a single JSON entity.

You can set up field indexes for faster document access, and the database includes a built-in DynamicView class that you can use to make use of indexes on data subsets. LokiJS can be used in the browser or in a node.js environment.

The developers say that LokiJS draws inspiration from MongoDB and CouchDB, in that the API is similar (but not identical or compliant) to MongoDB and you can define your own views in a CouchDB style.

The fact that new databases are still appearing in the JavaScript space highlights the fact that there’s still no clear winner in what’s a confusingly crowded sector where alternatives such as NeDB, MiniRedis, and SQL.JS all have their fans. Whether LokiJS can become a market leader remains to be seen.  




Trusted Language Extensions Bring PostgreSQL Procedural UDFs To The Cloud

Trusted Language Extensions on Amazon allow you to write PostgreSQL user-defined functions for its cloud database offerings in one of several supported programming languages.

Stack Overflow Traffic Slumps As Devs Turn to ChatGTP

We are all becoming increasingly are aware of the threat to jobs across many industries from AI-powered technology. However, Stack Overflow has been an immediate casualty as developers discover the ex [ ... ]

More News






or email your comment to: comments@i-programmer.info

Last Updated ( Tuesday, 18 November 2014 )