Skip to content

tmeasday/meteor-models

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published