NeDBNode 嵌入式數(shù)據(jù)存儲
Node.js 實現(xiàn)的嵌入式數(shù)據(jù)存儲,可以部分或全部替代sqlite數(shù)據(jù)庫??梢援?dāng)內(nèi)存數(shù)據(jù)庫使用也可本地存儲。
NEDB采用非常靈活的查詢方式,讓你幾乎可以忘記他是非關(guān)系數(shù)據(jù)庫:
(1) 可以使用正則查詢
(2) and or where 大于 小于 排序等
(3) 索引
數(shù)據(jù)存儲采用JSON新式,可以深度查詢。
eg:
// Let's say our datastore contains the following collection
{ _id: 'id5', completeData: { planets: [ { name: 'Earth', number: 3 }, { name: 'Mars', number: 2 }, { name: 'Pluton', number: 9 } ] } }
db.find({ "completeData.planets.0.name": "Earth" }, function (err, docs) { // docs contains document 5 // If we had tested against "Mars" docs would be empty because we are matching against a specific array element });
語法和MongoDB非常相似.
Speed
-
Insert: 5,950 ops/s
-
Find: 25,440 ops/s
-
Update: 4,490 ops/s
-
Remove: 6,620 ops/s
Memory footprint
A copy of the whole database is kept in memory. This is not much on the expected kind of datasets (20MB for 10,000 2KB documents). If requested, I'll introduce an option to not use this cache to decrease memory footprint (at the cost of a lower speed).
缺點:數(shù)據(jù)加載在內(nèi)存中進行操作,不適合內(nèi)存非常緊張的應(yīng)用。目前作者沒有給出細膩度的內(nèi)存控制方法。
評論
圖片
表情
