|
|
|
@ -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; |
|
|
|
|