self-contained mongodb implementation
Inspired by meteor
- I wanted a decoupled library with the same level of functionality provided in meteor
- Cached on the client-side, and server-side. Less hits to mongodb itself.
- Allows for users to be sandboxed in their own collection (authentication).
- listening to cursors for any change
- fork mongoose ODM and use this as the default driver
- REST interface mapper
- sync items to backend (persistence api)
- rest gateway example
- DNode driver
- Http driver
- object modifiers: $inc, $set, $unset, $push $pushAll, $addToSet, $pop, $pull, $pullAll, $rename, $bit (should be separate repo - fiddle?)
- cursor.emit("update") when limit, selector, or skip have changed
Here's a simple example using the memory driver:
var mdblite = require'mongodblite'db = mdblitedbMemory;var people = dbcollection'people';//add some datapeopleinsertname: "Craig"age: 22name: "Tim"age: 21name: "John"age: 20;//create a filter against the "people" collectionvar peopleOlderThan21 = peoplefindage:$gt:21limit20;peopleOlderThan21observe//the filtered items - max = 20console.logobserversource;observeron"insert"//craig - source is also updated;//called when something big changes, such as limit, or skipobserveron"reset";;//insert a new user, triggers listener abovepeopleinsertname: "Sarah"age: 22