首页 > 解决方案 > 使用nedb时重命名错误

问题描述

使用nedb时,我收到重命名错误为

/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'

我连接到数据库为:

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

为什么我会收到重命名错误?

标签: node.jsnedb

解决方案


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

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


推荐阅读