LEDB interface for NodeJS

The LEDB is an attempt to implement simple but efficient, lightweight but powerful document storage.
The abbreviation LEDB may be treated as an Lightweight Embedded DB, also Low End DB, also Literium Engine DB, also LitE DB, and so on.
Links
Features
- Processing JSON documents
- Identifying documents using auto-incrementing integer primary keys.
- Indexing fields of documents using unique or duplicated indexes.
- Searching and ordering documents using indexed fields or primary key.
- Selecting documents using complex filters with fields comparing and logical operations.
- Updating documents using rich set of modifiers.
- Storing documents into independent storages so called collections.
- Flexible JSON query filters similar to a MongoDB.
- The LMDB as backend for document storage and indexing engine.
Installation
Until pre-compiled binaries is missing you need Rust build environment for building native module.
Use latest stable Rust compiler. You can install it using rustup or packages in your system.
Usage example
import { Storage } from 'ledb';
const storage = new Storage("test_db/storage");
console.log("Storage info:", storage.get_info());
console.log("Storage stats:", storage.get_stats());
const posts = storage.collection("post");
let doc_id = posts.insert({title: "Foo", tag: ["Bar", "Baz"], timestamp: 1234567890);
let doc = posts.get(doc_id);
console.log("Inserted document: ", doc);
posts.put(doc);
posts.delete(doc_id);
posts.ensure_index("title", "unique", "string")
posts.ensure_index("tag", "index", "string")
console.log("Indexes of post:", posts.get_indexes())
let docs = posts.find(null);
let docs = posts.find(null, "$desc");
let docs = posts.find(null, { timestamp: "$asc" });
let docs = posts.find({ title: { $eq:"Foo" } });
let docs = posts.find({ $not: { title: { $eq: "Foo" } } });
let docs = posts.find({ $and: [ { timestamp: { $gt: 123456789 } } ,
{ tag: { $eq: "Bar" } } ] },
{ timestamp: "$desc" });
let docs = posts.find({ $or: [ { title: { $eq: "Foo" } } ,
{ title: { $eq: "Bar" } } ] });
console.log("Found docs:", docs.count())
for (let doc; doc = docs.next(); ) {
console.log("Found doc:", doc);
}
docs.skip(3);
docs.take(5);
console.log("Found documents:", docs.collect());
posts.update(null, { timestamp: { $set: 0 } });
posts.update({ timestamp: { $le: 123456789 } }, { timestamp: { $set: 0 } });
posts.remove(null);
posts.remove({ timestamp: { $le: 123456789 } });
See also ledb.d.ts.