Node的 Flat JSON 文件數據庫:lowdb
Node的 Flat JSON 文件數據庫
- 無服務器
- 快捷
- 事件觸發
- 來自 Lo-Dash 的 50+多個方法
LowDB構建在 Lo-Dash, 這使得它非常不同、獨特,相比其他往往是基于MongoDBAPI的無服務器數據庫。
LowDB powers JSON Server and JSONPlaceholder.
Usage
var low = require('lowdb') low('songs').insert({title: 'low!'})
Database is automatically created and saved to db.json
in a readable format.
{ "songs": [ { "title": "low!", "id": "e31aa48c-a9d8-4f79-9fce-ded4c16c3c4c" } ] }
To query data, you can use Lo-Dash methods.
var songs = low('songs').where({ title: 'low!' }).value()
Or LowDB equivalent short syntax.
var songs = low('songs', { title: 'low!' })
Changes can also be monitored.
low.on('add', function(name, object) { console.log(object + 'added to' + name) })
Benchmark
get x 1000 0.837708 ms
update x 1000 4.433322 ms
insert x 1000 11.78481 ms
remove x 1000 24.60179 ms
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!