/meteor-collection-mixin

Allows users to refactor collection's common code into a separate module which we call collection mixin.

Primary LanguageCoffeeScript

Overview

To extract common code from a collection

Example usage:

TestSchema = new Mongo.Collection('test')
TestSchema.includeCollectionMixins(exampleMixin, exampleMixin1, so on..)

Format of mixin to be passed:

exampleMixin = {
  schema: (collection)->
    new SimpleSchema
      "sample":
        type: String

  #add methods to document's object

  helpers:
    mixinHelperMethod: -> true

  #add methods to collection's object

  collectionHelpers:
    mixinCollectionHelperMethod: -> true
}