facebookarchive / react-meteor

React rendering for Meteor apps
948 stars 113 forks source link

Can't Do any queries, but i can in the console. #106

Open PatrickOfRubiconRealm opened 8 years ago

PatrickOfRubiconRealm commented 8 years ago

Terms.find is not a function at ReactMeteor.createClass.getMeteorState (terms.cjsx.coffee?74088d56821338029b2cb45b8109b45608090075:16) at enqueueMeteorStateUpdate (ReactMeteor.js:52) at ReactMeteor.js:19 at Tracker.Computation._compute (tracker.js:294) at new Tracker.Computation (tracker.js:210) at Object.Tracker.autorun (tracker.js:533) at ReactMeteorMixin.componentWillMount (ReactMeteor.js:9) at 43.ReactCompositeComponentMixin.mountComponent (react-with-addons-0.13.0.js:6847) at 82.ReactPerf.measure.wrapper as mountComponent at Object.89.ReactReconciler.mountComponent (react-with-addons-0.13.0.js:14720)

froatsnook commented 8 years ago

How do you define Terms?

PatrickOfRubiconRealm commented 8 years ago

Like this:

@Terms = new Meteor.Collection('terms')

Schemas.Terms = new SimpleSchema(

content: type: String autoform: afFieldInput: type: "textarea" rows: 60

createdAt: type: Date autoValue: -> if this.isInsert new Date()

effectiveDate: type: Date autoValue: -> if this.isInsert new Date() )

Terms.attachSchema Schemas.Terms Meteor.subscribe('terms') if (Meteor.isClient)

(thanks)

PatrickOfRubiconRealm commented 8 years ago

My bad... i think this was that i forgot a subscribe

froatsnook commented 8 years ago

I think it must be something else. If you don't subscribe then it will just never return any documents. But Terms.find should still be a function.

Which file is Terms defined in? Is it defined in the root of the file? Or on Meteor.startup? Or something else?

But never mind if it already works. If so, feel free to close the issue.