1

while using nedb, I get rename error as

/home/rajiv/Coding/vote-for-change/node_modules/nedb/lib/datastore.js:77
    if (err) { throw err; }
            ^

Error: ENOENT: no such file or directory, rename '/home/rajiv/Coding/vote-for-change/logs/votersLog~' -> '/home/rajiv/Coding/vote-for-change/logs/votersLog'

I am connecting to the database as:

var db = new Datastore({
    filename: '/home/rajiv/Coding/vote-for-change/logs/votersLog',
    autoload: true
});

why am I getting rename error?

Rajiv Sah
  • 21
  • 1

3 Answers3

1

You are probably creating multiple instances of the datastore with the same filename.

Credit to this issue: https://github.com/louischatriot/nedb/issues/136

Mr. Goferito
  • 6,391
  • 4
  • 26
  • 27
0

The path should be pointed correctly.you cannot simply use absolute path ("/home/rajiv...") .First check your current directory using path,then route it accordingly.

var path = require('path');
console.log(path.join(__dirname))
new Datastore({
    filename: (path.join(__dirname)+"/home/rajiv/Coding/vote-for-change/logs/votersLog"),
    autoload: true
});
Anusha kurra
  • 482
  • 3
  • 9
0

That's a generic error. You can get it lots of different ways, without getting any additional useful information.

You need to reproduce the problem in a small simple sample and experiment with things like the pathname to see what triggers it. Best of luck.

david.pfx
  • 10,520
  • 3
  • 30
  • 63