I have written NodeWebKitApp
in which I save user's data (like name, uid and settings) for later use. I can insert a document fine and I can see its content. The file size is about 2KB.
But, if I close the app and then re-open it, the saved data is lost and I see a file size of 0 bytes.
Debugging, I discovered that this behavior occurs when the following line is executed:
db = new Datastore({ filename: myPath, autoload: true });
I tried to debug nedb/persistance.js
but could not resolve the issue. I also tried loading the database manually by calling loadDatabase(function(err) {})
but without success.
Here is a snippet of code:
var Datastore = require('nedb'),
..
..
..
myPath = "<User-Home>/.myApp/user.db",
db = new Datastore({ filename: myPath, autoload: true });