var Datastore = require('nedb')
, db = new Datastore({ filename: 'testdb.db', autoload: true });\
var doc = { hello: 'world'
, n: 5
, today: new Date()
, nedbIsAwesome: true
, notthere: null
, notToBeSaved: undefined // Will not be saved
, fruits: [ 'apple', 'orange', 'pear' ]
, infos: { name: 'nedb' }
};
db.insert(doc, function (err, newDoc) {
console.log(newDoc);
});
I can't find "testdb.db" anywhere in my computer, but the console log show the data exist! Any suggestion?
Give absolute file location of where the db needs to be stored like below
var db = new DataStore({filename:path.join(__dirname, '/nedb.db'), autoload:true});
Otherwise data will get stored in the location from where you are executing it