Many document stores, Y U NO interface?
Work in progress; see TODO.
Minimalistic ODM for Node.js implementing the most fundamental operations (such as
DEL) on different kinds of "document(-ish)" stores using one unified API. Switching database should be a matter of changing a line of code.
To stick to this philosophy more advanced operations won't be supported in core, but
node-document can be used along with any 3rd-party drivers.
Unified interface for write/read data to/from differen kinds of storages/databases.
- Operations: Single + Bulk
- Connect-on-demand: Auto-connect on first operation (operation queue)
Unified interface for validating data based on a custom JSON Schema.
Unified interface for diffing objects to see changes between the two (additions/removals/edits).
$ npm install node-document
var Document = ;// Some storages of choice - install via NPMvar Redis = ; // NOTE: $ npm install node-document-storage-redisvar FileSystem = ; // NOTE: $ npm install node-document-storage-fs// A modelvar Post = Document'Post' 'redis://localhost:6379/app';// ...or shortcut: var Post = Document('Post', 'redis://localhost:6379/app');// A recordvar post = title: "Once upon a time";// Save itpost;// etc.})
More usage examples coming soon, unil then checkout the tests.
$ make test
$ make test-remote
This project is very much work-in-progress; the API will most probably change between the first couple of minor version numbers until it will be settled.
- Christian Landgren - input and feedback
Released under the MIT license.
Copyright (c) Jonas Grimfelt