louischatriot / nedb

The JavaScript Database, for Node.js, nw.js, electron and the browser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Database updates require server restart

ScriptedAlchemy opened this issue · comments

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?

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.

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

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

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