LokiJS: in-memory NoSQL datastore for Cordova apps

Fran Dios
Fran Dios
Jul 8, 2015 · 2 min read
Image for post
Image for post

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.

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.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store