LokiJS: in-memory NoSQL datastore for Cordova apps

Fran Dios
Fran Dios
Jul 8, 2015 · 2 min read

LokiJS is a lightweight JavaScript in-memory database made by Techfort that provides a document-oriented alternative to the already well known SQLite. For many applications a NoSQL approach could be more preferable than relational data when working with complex object stores. LokiJS gives us the chance to do this in a very efficient way.

LokiJS is intended to be used as an in-memory database with the possibility of persisting the data. It is compatible with Node.js (filesystem) and browsers, which means that it can be also used in our hybrid mobile Cordova apps (localStorage and indexedDB).

A block of code is worth a thousand words:

Furthermore, LokiJS supports field indexing for faster document access and provides a built-in DynamicView class that also enables to use indexes on data subsets for even faster performance. DynamicViews work as queries that are recomputed in the background when data changes, so once a view is created you never have to worry about recalling or refreshing data, it is always updated and available.

It is also available for AngularJS through the lokijs module:

Its low footprint and high performance, along with a bunch of other features, make it worth giving a try! You can follow its Github repo here and learn more about it here. We hope you find this tool useful for your future hybrid apps!

Originally published at onsen.io on July 8, 2015.

The Web Tub

Pushing the web current through hybrid mobile and PWA…

Fran Dios

Written by

Fran Dios

I create apps from Tokyo with love. I also like tomatoes.

The Web Tub

Pushing the web current through hybrid mobile and PWA technology. Presented by the Monaca and Onsen UI team.

More From Medium

More from The Web Tub

More from The Web Tub

Build a PWA using Workbox

Jan 23, 2019 · 6 min read

Also tagged JavaScript

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade