All Projects → tmeasday → meteor-models

tmeasday / meteor-models

Licence: other
No description, website, or topics provided.

Programming Languages

javascript
184084 projects - #8 most used programming language

Meteor Models

This is a basic proof of concept of the way meteor models could work. It builds on the code in this pull request.

To use, do something like

  var Post = function(attrs) {
    Model.call(this, attrs);
  }
  Post.prototype = new Model({});
  Post.prototype.constructor = Post;

  var Posts = Post._collection = new Meteor.Collection('posts', null, null, Post);

Then 2 things happen, firstly you can use the Model class to save and update posts:

  var post = new Post({title: 'A great post'});
  post.save();

And when you query the collection, you will get posts out:

  var post = Posts.findOne(); // a Post object
  
  post.update_attribute('title', 'a new title');

For some ideas on how this could be expanded in the future, see the model class from the League project.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].