-
-
Save tagrudev/a99d1882af708ed7d74a to your computer and use it in GitHub Desktop.
collection-helpers problem ?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TypeError: Object [object Object] has no method 'findOrCreateBy' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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