diff --git a/lib/datastore.js b/lib/datastore.js index c24a6b8..08dabd8 100644 --- a/lib/datastore.js +++ b/lib/datastore.js @@ -202,6 +202,9 @@ Datastore.prototype._loadDatabase = function (cb) { , self = this ; + // In-memory only datastore + if (!self.filename) { return callback(); } + customUtils.ensureDirectoryExists(path.dirname(self.filename), function (err) { fs.exists(self.filename, function (exists) { if (!exists) { @@ -302,6 +305,9 @@ Datastore.prototype.persistNewState = function (newDocs, cb) { , callback = cb || function () {} ; + // In-memory only datastore + if (!self.filename) { return callback(); } + self.datafileSize += newDocs.length; newDocs.forEach(function (doc) { @@ -519,5 +525,4 @@ Datastore.prototype.remove = function () { - module.exports = Datastore; diff --git a/package.json b/package.json index 449a603..0053eeb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nedb", - "version": "0.6.0", + "version": "0.6.1", "author": { "name": "tldr.io", "email": "hello@tldr.io"