What's the best way to attach behavior to a Meteor Collection?

后端 未结 6 1778
陌清茗
陌清茗 2020-12-25 14:38

In Meteor, when you retrieve a record from a database, it\'s only a record. So if I have a collection called Dogs, a dog might have fur: \'br

6条回答
  •  独厮守ぢ
    2020-12-25 15:08

    While there might be an official model system in the works there are some things you can do now:

    There is one by Mario Uhler which is activerecord like and quite nice, in coffeescript: https://coderwall.com/p/_q9b1w

    There is also a community package made by Tom Coleman thats very helpful with models: https://github.com/tmeasday/meteor-models, you might need meteorite to add it as a package.

    And of course as you suggested Backbone. I personally use js prototypes but not everyone may be comfy with them, I just used them so its easy to transition when meteor's model system is out, its also easy to share between the client and server without too many packages to add.

提交回复
热议问题