Questions tagged [lokijs]

LokiJS is an in-memory JavaScript datastore with persistence.

LokiJS is:

  • In-Browser NoSQL db with syncing and persisting
  • a Redis-style store an npm install away
  • Persistable NoSQL db for Cordova
  • Embeddable NoSQL db with Persistence for node-webkit
106 questions
3
votes
1 answer

Lokijs - Simple query not working

I'm querying something simple from the database and it keeps returning me an empty array. I tried several ways following the documentation on the site. user.chain().find({ email: 'test@gmail.com' }).data(); I tried this as well: user.find({…
Mark
  • 1,603
  • 3
  • 13
  • 18
3
votes
2 answers

lokijs - is there a way to make a compound unique index in loki?

Is there a way to specify a compound unique index in loki ? I tried something like: db.addCollection('contents', {unique: ['id', 'wsID']}); but this appears to make 2 different unique indexes.. it's the combination of the two that I'd like to…
3
votes
1 answer

Unable to save db with lokiJS as json file

I'm testing LokiJS in my browser. I want to save the db created as json file in same folder. But nothing happens. This is the code that i found online and i'm testing: var db = new loki('test.json'); var db2 = new loki('test.json'); var users =…
Mr.M
  • 135
  • 2
  • 12
3
votes
2 answers

LokiJs collection find return list in Ascending order

How do i get to sort a loki js collection in a ascending order var categoryCollection = offlineDb.getCollection('Category'); var catColl = categoryCollection.find({ 'Id': { '$ne': null } }); I debug and i see that the $loki is also in the reverse…
user581157
  • 1,327
  • 4
  • 26
  • 64
3
votes
1 answer

NodeJS: Can you use plain Javascript objects as an in-memory datastore?

Rather than use the likes of Redis, or even LokiJS (which looks great), can I just create a large javascript collection in memory as my app runs, and query that instead?
Charlie
  • 4,197
  • 5
  • 42
  • 59
3
votes
1 answer

Does Lokijs generates its own IDs?

I've been trying to use lokijs on a project. Does Lokijs generates its own IDs? Or do we need to handle that our selves?
Pedro Luz
  • 2,694
  • 4
  • 44
  • 54
2
votes
0 answers

Loki js: 8 requests failed to load;

I have a frontend application using React. In the project I use Storybook. And for regression screenshot testing of ui-elements, I use the "loki" library (loki.js.org). "Loki" works fine locally("dev" mode), but I want to use it in CI. And for this,…
Fronter
  • 21
  • 2
2
votes
0 answers

Is it possible to get a hash (e.g. SHA256 hash) of lokijs database contents?

I'm building an application in which I need to compute a cryptographic hash on the database. I need it to be deterministic. That is, I will have different instances of the database, which should be identical, and which should result in identical…
Duncan
  • 507
  • 3
  • 14
2
votes
0 answers

How to resolve error 'this.fs.stat is not a function' when using LokiJS and Angular?

I'm getting the error ('this.fs.stat is not a function') on line 2256 of lokijs.js. Environment is Electron with Angular 5.x and LokiJS v1.5.3. fs is set up on line 2244 of lokijs.js (this.fs = require('fs');) but when I examine this.fs in the…
TimTheEnchanter
  • 3,370
  • 1
  • 26
  • 47
2
votes
2 answers

How to query multiple tables (join) with LokiJS?

Since I'm unable to use SQLite in a node-webkit app, I'm looking at LokiJS but I cannot seem to find an easy way of making joins or some kind of relations between 2 datasets. One dataset is artists and the other is media. Since it could possibly…
Jeremy Dicaire
  • 4,615
  • 8
  • 38
  • 62
2
votes
1 answer

How can I use LokiJs in the browser?

I suspect this is a bit of a simple question, as I'm not very experienced with the frontend. I'm trying to use lokijs as a datastore in a browser app, but I can't get it to run. I have in my…
Peter Dolan
  • 1,393
  • 1
  • 12
  • 26
2
votes
2 answers

how to use lokijs-cordova-fs-adapter in ionic 2

I am trying to use lokijs in my ionic 2 app. i am able to use lokijs.js. when trying to persist using adapter i am not able to. i ready lokijs-cordova-fs-adapter can be used. but when i refer it in my app as below: getting an error that its not able…
praveen seela
  • 538
  • 11
  • 24
2
votes
1 answer

Update Whole Document in MongoDb

I am trying to insert and update document in mongodb using node.js. I can successfully insert the document using the following code. var obj = { jsonit: { users: {}, groups: {}, meta: { id:…
Abdul Bari
  • 149
  • 1
  • 2
  • 12
2
votes
1 answer

lokijs loses db and data in collection when i try to add more data after colesing my cordova app an relunching it

All: I am pretty new to Lokijs, I wonder how can I reload the database and collection which has been persisted? Say that I build a database and collection, then I persist it( like click a button to trigger persistence process): var db = new…
Lawrence Nwoko
  • 79
  • 1
  • 10
2
votes
1 answer

Lokijs: Inserting document with unique key violation

I am running the latest, as of 5.3.2016, minified Lokijs from Lokijs.org and NW.js v0.12.3-win-x64. I have a document already saved in…
eschlosser
  • 23
  • 5