louischatriot / nedb

The JavaScript Database, for Node.js, nw.js, electron and the browser
MIT License
13.46k stars 1.03k forks source link

Database updates require server restart #659

Open ScriptedAlchemy opened 3 years ago

ScriptedAlchemy commented 3 years ago

Hey. Im having issues where i need to restart the server to see database updates Is there anything you're aware of that could've caused this?

hernancorigliano commented 3 years ago

If you are modifying the db file manually, you need to restart the server. But otherwise, seems to be working fine. I insert new records and see them in a query instantly.

fl3xice commented 3 years ago

The same thing, everything works fine with insertion, but when update(), fields with the same id appear in the database, and after updating the server or loading the database, they are combined into one and displayed normally

bogere commented 3 years ago

Please enable autoCompaction for the nedb database like this. `const { salesDB } = require('./db')

//The database is automatically compacted (i.e. put back in the one-line-per-document format) every time //you load each database within your application. avoid the duplicate _ids during update or delete. `salesDB.persistence.setAutocompactionInterval(5000) //5-10 seconds`` Read more here. https://github.com/louischatriot/nedb#persistence

fl3xice commented 3 years ago

Everything okay! it's my bad, @ScriptedAlchemy maybe close issue?