我正在尝试从电子应用程序连接到 nedb。CRUD 操作效果很好。但是我没有看到 db 文件(D:/my.db,检查了隐藏文件)。文件存在于某处,因为即使在机器重新启动后它也会保留数据。我怀疑电子威胁我的相对路径,但我可以在任何地方找到它。
var Datastore = require('nedb'), db = new Datastore({filename : 'D:/my.db', autoload: true});
var doc = { hello: 'world'
, n: 5
, today: new Date()
, nedbIsAwesome: true
, notthere: null
, notToBeSaved: undefined // Will not be saved
, fruits: [ 'apple', 'orange', 'pear' ]
, infos: { name: 'nedb' }
};
db.insert(doc, function (err, newDoc) { // Callback is optional
// newDoc is the newly inserted document, including its _id
// newDoc has no key called notToBeSaved since its value was undefined
});