文件名称:
嵌入式文档数据库LinvoDB.zip
开发工具:
文件大小: 399kb
下载次数: 0
上传时间: 2019-07-17
详细说明: LinvoDB 是一个 Node.js/NW.js 的嵌入式数据库引擎,类似 MongoDB 和类 Mongoose 数据库,提供类似的接口,基于 NeDB 开发。特性:类 MongoDB 的查询引擎基于 LevelUP 的持久化,可选择不同后端NW.js 友好 - JS-only backend is Medea高性能 - steady performance unaffected by DB size - queries are always indexed自动索引Live queries - make the query, get constantly up-to-date resultsSchemas - built-in schema support Efficient Map / Reduce / Limit示例代码:var LinvoDB = require("linvodb3"); var modelName = "doc"; var schema = { }; // Non-strict always, can be left empty var options = { }; // options.filename = "./test.db"; // Path to database - not necessary // options.store = { db: require("medeadown") }; // Options passed to LevelUP constructor var Doc = new LinvoDB(modelName, schema, options); // New model; Doc is the constructor LinvoDB.dbPath // default path where data files are stored for each model LinvoDB.defaults // default options for every model插入数据:// Construct a single document and then save it var doc = new Doc({ a: 5, now: new Date(), test: "this is a string" }); doc.b = 13; // you can modify the doc doc.save(function(err) { // Document is saved console.log(doc._id); }); // Insert document(s) // you can use the .insert method to insert one or more documents Doc.insert({ a: 3 }, function (err, newDoc) { console.log(newDoc._id); }); Doc.insert([{ a: 3 }, { a: 42 }], function (err, newDocs) { // Two documents were inserted in the database // newDocs is an array with these documents, augmented with their _id // If theres an unique constraint on a, this will fail, and no changes will be made to the DB // err is a uniqueViolated error }); // Save document(s) // save is like an insert, except it allows saving existing document too Doc.save([ doc, { a: 55, test: ".save is handy" } ], function(err, docs) { // docs[0] is doc // docs[1] is newly-inserted document with a=55 and has an assigned _id // Doing that with .insert would throw an uniqueViolated error for _id on doc, because it assumes all documents are new }); 标签:LinvoDB
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
相关搜索: