If no filename is specified, an in-memory only datastore is created

pull/2/head
Louis Chatriot 12 years ago
parent c9cba88a80
commit afe3bfa6d4
  1. 7
      lib/datastore.js
  2. 2
      package.json

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

@ -1,6 +1,6 @@
{
"name": "nedb",
"version": "0.6.0",
"version": "0.6.1",
"author": {
"name": "tldr.io",
"email": "hello@tldr.io"

Loading…
Cancel
Save