now-mongoose
v0.0.1
Published
Exposes MongooseJS models to NowJS clients.
Downloads
6
Readme
MongooseJS models for NowJS clients
To enable:
To activate, when you're ready:
Parameters are:
- the MongooseJS model class you created using the mongoose.model() api
For example, let's say you have a mongoose model named Adventure which you want to expose to connected clients via a real-time API:
SERVER SIDE
Now on the CLIENT SIDE, you can do this:
In addition, now-mongoose also exposes all static methods defined on your Mongoose model to the NowJS client, so using the example above, calling:
would work and return you the updated adventure after the new rsvp was saved for the given user id.
NOTE: Model instance level methods are more tricky and I haven't figured out how to proxy those yet, any suggestions welcome!