MyDB client component
MyDB client component.
$ component install cloudup/mydb-client
var mydb = require'mydb''mydb.host.com';mydbget'/woot/woot';
Connects to the mydb
If a parameter is not supplied it will connect to
Alternatively, an engine.io client options object can be supplied.
Document by subscribing to the supplied
url is optional, if a vanilla document is desired. See
Each document represents a subscription to a given resource URL.
Returns the associated manager.
Returns the sebscription id.
unloaded: no subscription (default when no
loading: loading a resource
loaded: resource is loaded
unloading: subscription is being destroyed
url this document is loaded from / loading.
Loads a document from the given URL. If
fn is supplied, it's passed
Calls the supplied
fn when the resource is loaded. If the resource
is already loaded, the function is fired on the next tick.
Returns the value of the given
key, which can use dot
It throws if the document is not loaded.
fn is supplied,
ready is called first, and the value is passed
to the callback.
Subscribes to changes for the given
- If no operator is supplied,
fngets called upon any operation.
- Operations that don't change the document are ignored by mongo-query.
- If an operation is supplied as the second parameter, the
first parameter of the event callback will be the
valueproperty of the
logobject. For example, if the operation is a
$push, the value that's pushed is the first parameter.
- Otherwise, the first parameter is always the new value of the given
after). For example, if the operation is acting on an array, like pushing, pulling or popping, you will still get the reference to the entire array.
- The second parameter of the event callback is always the
logobject returned by mongo-query.
ready, then calls
fn with the initial value of the given
key, and subscribes to subsequent change events for
ready, then calls
fn for each value of the array found under
Destroys this subscription.
fn gets called when the unsubscription
for the current id is confirmed.