本文介绍了NEDB坚持电子应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试从电子应用程序连接到nedb。 CRUD操作很有效。但我没有看到db文件(D:/my.db,检查隐藏文件)。文件存在于某处,因为它甚至在机器重启后仍保留数据。我怀疑电子威胁我的路径是相对的,但我可以在任何地方找到它。
I am trying to connect to nedb from electron app. CRUD operations work great. BUT I don't see db file (D:/my.db, checked for hidden files). File exists somewhere, because it keeps data even after machine reboot. I suspect that electron threats my path as relative, but I can find it anywhere.
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
});
推荐答案
说
这篇关于NEDB坚持电子应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!