Skip to content

Instantly share code, notes, and snippets.

@tagrudev
Created December 2, 2014 13:13
Show Gist options
  • Save tagrudev/a99d1882af708ed7d74a to your computer and use it in GitHub Desktop.
Save tagrudev/a99d1882af708ed7d74a to your computer and use it in GitHub Desktop.
collection-helpers problem ?
TypeError: Object [object Object] has no method 'findOrCreateBy'
@Projects = new Mongo.Collection("projects")
Schemas = {}
Schemas.Project = new SimpleSchema(
_id:
type: String
optional: true
projectName:
type: String
projectType:
type: String
)
@Projects.helpers
findOrCreateBy: (project) ->
@Projects.upsert
projectName: project.projectName
,
$set:
projectType: projectType
, (error, result) ->
console.log error if error?
return
@Projects.attachSchema(Schemas.Project)
Meteor.startup ->
project = Json.someJSON
Projects.findOrCreateBy(project)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment