LokiJS saveDatabase to persistence issue

252 Views Asked by At

I've been working with lokijs on node and use it with express and socket and typescript.

Now i've got two instances of loki database and when I use db.saveDatabase() it is not set in the file although I did initialize with new Loki(${DB_PATH}/${DB_NAME}, { persistenceMethod: 'fs'});. The collection itself seems to be well updated but somehow this can't be set to persistence after the db has been updated with an entry earlier by reloading the webpage. Even the callback which I added in saveDatabase is running db.saveDatabase((error) => { console.log(Do we have an error: ${error}) });

I run it local on a windows 10 machine. Rights to the folder seems to be ok.

1

There are 1 best solutions below

0
On

Looks for now that persistenceMethod: "localStorage" is working but it is not as it should as i will store this on the server and documentation tells me to use "fs", also the db.json seems not to be updated... but somehow the data is wel read and saved in the application?