For my current project, I have been utilizing lokijs on node alongside express, socket, and typescript. Recently, I encountered an issue where I have two instances of loki database and when attempting to use db.saveDatabase()
, it does not save the changes to the file. Despite initializing it with
new Loki(`${DB_PATH}/${DB_NAME}`, { persistenceMethod: 'fs'});
, the collection appears to be updated correctly but the persistence is not being properly set after updating the database with an entry earlier and reloading the webpage. Even the callback function included in the saveDatabase method is triggering as expected - db.saveDatabase((error) => { console.log(`Do we have an error: ${error}`) });
This development is being done locally on a Windows 10 machine and everything seems to be correct with regards to folder permissions.