Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Meteor.Collection.getAll is not a function #6

Closed
sebastianconcept opened this issue May 4, 2016 · 12 comments
Closed

TypeError: Meteor.Collection.getAll is not a function #6

sebastianconcept opened this issue May 4, 2016 · 12 comments

Comments

@sebastianconcept
Copy link

sebastianconcept commented May 4, 2016

I'm reaching this exception in a [email protected] app.

Throws it at:
https://github.com/abecks/meteor-infinite-scroll/blob/master/infinite-scroll.js#L75

I suggest:

  const collectionExists = !!global[options.collection] && (global[options.collection] instanceof Meteor.Collection);
    // Collection exists?
  if (!collectionExists) {
    throw new Error('Collection does not exist: ', options.collection);
  } else {
    //set collection to cursor. collectionExists.name evaluates to a string
    collection = global[options.collection];
  }
@JulianKingman
Copy link
Contributor

I'm getting a similar error, but from uglify, like this: meteor/meteor#5387

.../parse.js:196:18:   Unexpected token name (collectionExists)

@abecks
Copy link
Owner

abecks commented May 10, 2016

Will try to get this fixed. Short on time right now. Will accept PRs.

@JulianKingman
Copy link
Contributor

Made PR

@abecks
Copy link
Owner

abecks commented May 17, 2016

#7 merged and 0.9.1 pushed to Atmosphere. Please let me know if there are any issues!

@abecks abecks closed this as completed May 17, 2016
@fligen
Copy link

fligen commented Oct 31, 2016

Im still getting this issue.

TypeError: Meteor.Collection.getAll is not a function
at Blaze.TemplateInstance.infiniteScroll (infinite-scroll.js:75)
at Blaze.TemplateInstance. (categories.js:21)
at template.js:119
at Function.Template._withTemplateInstanceFunc (template.js:465)
at fireCallbacks (template.js:115)
at Blaze.View. (template.js:208)
at view.js:107
at Object.Blaze._withCurrentView (view.js:538)
at view.js:106
at Object.Tracker._runFlush (tracker.js:511)

@TheCodeLord
Copy link

Yep, I got the same issue

@abecks
Copy link
Owner

abecks commented Oct 31, 2016

I'll take a look at this today or tomorrow, feel free to submit a PR in the meantime

@abecks abecks reopened this Oct 31, 2016
@TheCodeLord
Copy link

Thanks, to specify my issue:

In Mozilla:
Exception in template helper: Blaze.TemplateInstance.prototype.parents@http://localhost:3000/packages/jwo1f_parent-template.js?hash=343a9da27d5234d375ef3579638ae1e6774bf36e:53:15

In Chrome:
Exception in template helper: TypeError: Cannot read property '_templateInstance' of null
at Blaze.TemplateInstance.parents (http://localhost:3000/packages/jwo1f_parent-template.js?hash=343a9da27d5234d375ef3579638ae1e6774bf36e:53:28)

@mizsha
Copy link
Contributor

mizsha commented Oct 31, 2016

@mizsha
Copy link
Contributor

mizsha commented Nov 1, 2016

#12

@TheCodeLord
Copy link

TheCodeLord commented Nov 1, 2016

I found my problem, I made a subscription for the collection and it conflicted with the one that this library is setting. After the subscription was deleted everything works like it is supposed to.

P.S. : The name of the collection (in this.infiniteScroll{ collection: 'name' }) should be as the name of your collection in Mongo not as the name of your collection in the model, in the model my collection started with capital case and in Mongo with lower, this throws: "Error: Collection does not exist: "

@abecks
Copy link
Owner

abecks commented Nov 1, 2016

Release 1.0.0 is out. Thanks @mizsha and @TheCodeLord. Please let me know if you have any further issues.

@abecks abecks closed this as completed Nov 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants